Skip to content

Commit

Permalink
fix(nxp): fix rounded corner image in NXP vglite (lvgl#6436)
Browse files Browse the repository at this point in the history
Signed-off-by: Ana Grad <ana.grad@nxp.com>
Co-authored-by: Ana Grad <ana.grad@nxp.com>
  • Loading branch information
cristian-stoica and anaGrad authored Jul 4, 2024
1 parent 0e10a7e commit cd7eccc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/draw/lv_draw_rect.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_a
bg_image_dsc->recolor_opa = dsc->bg_image_recolor_opa;
bg_image_dsc->tile = dsc->bg_image_tiled;
bg_image_dsc->header = header;
bg_image_dsc->clip_radius = dsc->radius;
t->type = LV_DRAW_TASK_TYPE_IMAGE;
lv_draw_finalize_task_creation(layer, t);
}
Expand Down
20 changes: 12 additions & 8 deletions src/draw/nxp/vglite/lv_draw_vglite_border.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,36 +142,40 @@ static void _vglite_draw_border(const lv_area_t * coords, const lv_area_t * clip

uint32_t num_rect = 0;
vg_lite_rectangle_t rect[MAX_NUM_RECTANGLES];
int32_t rect_width = coords->x2 - coords->x1;
int32_t rect_height = coords->y2 - coords->y1;
int32_t shortest_side = LV_MIN(rect_width, rect_height);
int32_t final_radius = LV_MIN(radius, shortest_side / 2);

if(border_side & LV_BORDER_SIDE_TOP) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = coords->x2 - coords->x1 + line_width;
rect[num_rect].height = line_width;
rect[num_rect].height = final_radius + ceil(line_width / 2.0f);
num_rect++;
}

if(border_side & LV_BORDER_SIDE_LEFT) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = line_width;
rect[num_rect].height = coords->y2 - coords->y1 + line_width;
rect[num_rect].width = final_radius + ceil(line_width / 2.0f);
rect[num_rect].height = coords->y2 - coords->y1 + line_width + 1;
num_rect++;
}

if(border_side & LV_BORDER_SIDE_RIGHT) {
rect[num_rect].x = coords->x2 - ceil(line_width / 2.0f);
rect[num_rect].x = coords->x2 - final_radius + 1;
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = line_width;
rect[num_rect].height = coords->y2 - coords->y1 + line_width;
rect[num_rect].width = final_radius + ceil(line_width / 2.0f);
rect[num_rect].height = coords->y2 - coords->y1 + line_width + 1;
num_rect++;
}

if(border_side & LV_BORDER_SIDE_BOTTOM) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y2 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y2 - final_radius + 1;
rect[num_rect].width = coords->x2 - coords->x1 + line_width;
rect[num_rect].height = line_width;
rect[num_rect].height = final_radius + ceil(line_width / 2.0f);
num_rect++;
}

Expand Down
2 changes: 1 addition & 1 deletion src/draw/nxp/vglite/lv_draw_vglite_img.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ static void _vglite_draw_pattern(const lv_area_t * clip_area, const lv_area_t *
/* Path to draw */
int32_t path_data[RECT_PATH_DATA_MAX_SIZE];
uint32_t path_data_size;
vglite_create_rect_path_data(path_data, &path_data_size, 0, coords);
vglite_create_rect_path_data(path_data, &path_data_size, dsc->clip_radius, coords);
vg_lite_quality_t path_quality = VG_LITE_MEDIUM;

vg_lite_path_t path;
Expand Down

0 comments on commit cd7eccc

Please sign in to comment.