fix drawing of 1px border with zero radius and AA
This commit is contained in:
@@ -1179,6 +1179,48 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
|
||||
/* Modify the corner_size if corner is drawn */
|
||||
corner_size ++;
|
||||
|
||||
/*If radius == 0 is a special case*/
|
||||
if(style->body.radius == 0) {
|
||||
/*Left top corner*/
|
||||
if(part & LV_BORDER_TOP) {
|
||||
work_area.x1 = coords->x1;
|
||||
work_area.x2 = coords->x2;
|
||||
work_area.y1 = coords->y1;
|
||||
work_area.y2 = coords->y1 + bwidth;
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
|
||||
/*Right top corner*/
|
||||
if(part & LV_BORDER_RIGHT) {
|
||||
work_area.x1 = coords->x2 - bwidth;
|
||||
work_area.x2 = coords->x2;
|
||||
work_area.y1 = coords->y1 + (part & LV_BORDER_TOP ? bwidth + 1 : 0);
|
||||
work_area.y2 = coords->y2 - (part & LV_BORDER_BOTTOM ? bwidth + 1 : 0);
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
|
||||
/*Left bottom corner*/
|
||||
if(part & LV_BORDER_LEFT) {
|
||||
work_area.x1 = coords->x1;
|
||||
work_area.x2 = coords->x1 + bwidth;
|
||||
work_area.y1 = coords->y1 + (part & LV_BORDER_TOP ? bwidth + 1 : 0);
|
||||
work_area.y2 = coords->y2 - (part & LV_BORDER_BOTTOM ? bwidth + 1 : 0);
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
|
||||
/*Right bottom corner*/
|
||||
if(part & LV_BORDER_BOTTOM) {
|
||||
work_area.x1 = coords->x1;
|
||||
work_area.x2 = coords->x2;
|
||||
work_area.y1 = coords->y2 - bwidth;
|
||||
work_area.y2 = coords->y2;
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*Depending one which part's are drawn modify the area lengths */
|
||||
if(part & LV_BORDER_TOP) work_area.y1 = coords->y1 + corner_size;
|
||||
else work_area.y1 = coords->y1 + radius;
|
||||
@@ -1217,6 +1259,8 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
|
||||
color.full += 0x123456;
|
||||
|
||||
/*Draw the a remaining rectangles if the radius is smaller then bwidth */
|
||||
if(length_corr != 0) {
|
||||
/*Left top correction*/
|
||||
@@ -1256,44 +1300,6 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
|
||||
}
|
||||
}
|
||||
|
||||
/*If radius == 0 one px on the corners are not drawn by main drawer*/
|
||||
if(style->body.radius == 0) {
|
||||
/*Left top corner*/
|
||||
if(part & (LV_BORDER_TOP | LV_BORDER_LEFT)) {
|
||||
work_area.x1 = coords->x1;
|
||||
work_area.x2 = coords->x1 + LV_ANTIALIAS;
|
||||
work_area.y1 = coords->y1;
|
||||
work_area.y2 = coords->y1 + LV_ANTIALIAS;
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
|
||||
/*Right top corner*/
|
||||
if(part & (LV_BORDER_TOP | LV_BORDER_RIGHT)) {
|
||||
work_area.x1 = coords->x2 - LV_ANTIALIAS;
|
||||
work_area.x2 = coords->x2;
|
||||
work_area.y1 = coords->y1;
|
||||
work_area.y2 = coords->y1 + LV_ANTIALIAS;
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
|
||||
/*Left bottom corner*/
|
||||
if(part & (LV_BORDER_BOTTOM | LV_BORDER_LEFT)) {
|
||||
work_area.x1 = coords->x1;
|
||||
work_area.x2 = coords->x1 + LV_ANTIALIAS;
|
||||
work_area.y1 = coords->y2 - LV_ANTIALIAS;
|
||||
work_area.y2 = coords->y2;
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
|
||||
/*Right bottom corner*/
|
||||
if(part & (LV_BORDER_BOTTOM | LV_BORDER_RIGHT)) {
|
||||
work_area.x1 = coords->x2 - LV_ANTIALIAS;
|
||||
work_area.x2 = coords->x2;
|
||||
work_area.y1 = coords->y2 - LV_ANTIALIAS;
|
||||
work_area.y2 = coords->y2;
|
||||
fill_fp(&work_area, mask, color, opa);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ const uint8_t * lv_font_get_bitmap(const lv_font_t * font_p, uint32_t letter)
|
||||
/**
|
||||
* Get the width of a letter in a font
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @param letter an UNICODE character code
|
||||
* @return the width of a letter
|
||||
*/
|
||||
uint8_t lv_font_get_width(const lv_font_t * font_p, uint32_t letter)
|
||||
|
||||
@@ -170,7 +170,7 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
/**
|
||||
* Give the length of a text with a given font
|
||||
* @param txt a '\0' terminate string
|
||||
* @param length length of 'txt' in bytes
|
||||
* @param length length of 'txt' in character count and not bytes(UTF-8 can be 1,2,3 or 4 bytes long)
|
||||
* @param font pointer to a font
|
||||
* @param letter_space letter space
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
|
||||
@@ -74,14 +74,14 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font_p,
|
||||
/**
|
||||
* Give the length of a text with a given font
|
||||
* @param txt a '\0' terminate string
|
||||
* @param char_num number of characters in 'txt'
|
||||
* @param font_p pointer to a font
|
||||
* @param length length of 'txt' in character count and not bytes(UTF-8 can be 1,2,3 or 4 bytes long)
|
||||
* @param font pointer to a font
|
||||
* @param letter_space letter space
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
lv_coord_t lv_txt_get_width(const char * txt, uint16_t char_num,
|
||||
const lv_font_t * font_p, lv_coord_t letter_space, lv_txt_flag_t flag);
|
||||
lv_coord_t lv_txt_get_width(const char * txt, uint16_t length,
|
||||
const lv_font_t * font, lv_coord_t letter_space, lv_txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Check next character in a string and decide if te character is part of the command or not
|
||||
|
||||
@@ -86,7 +86,7 @@ void lv_templ_set_style(lv_obj_t * templ, lv_templ_style_t type, lv_style_t *sty
|
||||
* @param type which style should be get
|
||||
* @return style pointer to the style
|
||||
* */
|
||||
lv_style_t * lv_btn_get_style(lv_obj_t * templ, lv_templ_style_t type);
|
||||
lv_style_t * lv_templ_get_style(lv_obj_t * templ, lv_templ_style_t type);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
|
||||
Reference in New Issue
Block a user