mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-25 18:29:26 +08:00
chore(vg_lite): fix path bounding_box typo (#7134)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
@@ -84,7 +84,7 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d
|
||||
|
||||
lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32);
|
||||
lv_vg_lite_path_set_quality(path, VG_LITE_HIGH);
|
||||
lv_vg_lite_path_set_bonding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &clip_area);
|
||||
|
||||
float radius_out = dsc->radius;
|
||||
float radius_in = dsc->radius - dsc->width;
|
||||
|
||||
@@ -72,7 +72,7 @@ void lv_draw_vg_lite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc
|
||||
|
||||
lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32);
|
||||
lv_vg_lite_path_set_quality(path, dsc->radius == 0 ? VG_LITE_LOW : VG_LITE_HIGH);
|
||||
lv_vg_lite_path_set_bonding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &clip_area);
|
||||
|
||||
/* outer rect */
|
||||
lv_vg_lite_path_append_rect(path,
|
||||
|
||||
@@ -61,7 +61,7 @@ void lv_draw_vg_lite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t *
|
||||
|
||||
lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32);
|
||||
lv_vg_lite_path_set_quality(path, dsc->radius == 0 ? VG_LITE_LOW : VG_LITE_HIGH);
|
||||
lv_vg_lite_path_set_bonding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_append_rect(path,
|
||||
coords->x1, coords->y1,
|
||||
lv_area_get_width(coords), lv_area_get_height(coords),
|
||||
|
||||
@@ -161,7 +161,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t *
|
||||
0);
|
||||
}
|
||||
|
||||
lv_vg_lite_path_set_bonding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_end(path);
|
||||
|
||||
vg_lite_path_t * vg_lite_path = lv_vg_lite_path_get_path(path);
|
||||
|
||||
@@ -204,7 +204,7 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d
|
||||
clip_area.x1, clip_area.y1,
|
||||
lv_area_get_width(&clip_area), lv_area_get_height(&clip_area),
|
||||
0);
|
||||
lv_vg_lite_path_set_bonding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_end(path);
|
||||
|
||||
vg_lite_path_t * vg_lite_path = lv_vg_lite_path_get_path(path);
|
||||
@@ -264,7 +264,7 @@ static void draw_letter_outline(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_
|
||||
vg_lite_matrix_t matrix;
|
||||
vg_lite_identity(&matrix);
|
||||
|
||||
/* matrix for drawing, different from matrix for calculating the bonding box */
|
||||
/* matrix for drawing, different from matrix for calculating the bounding box */
|
||||
vg_lite_matrix_t draw_matrix = u->global_matrix;
|
||||
|
||||
/* convert to vg-lite coordinate */
|
||||
@@ -289,7 +289,7 @@ static void draw_letter_outline(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_
|
||||
lv_point_precise_t p2_res = lv_vg_lite_matrix_transform_point(&result, &p2);
|
||||
|
||||
/* Since the font uses Cartesian coordinates, the y coordinates need to be reversed */
|
||||
lv_vg_lite_path_set_bonding_box(outline, p1_res.x, p2_res.y, p2_res.x, p1_res.y);
|
||||
lv_vg_lite_path_set_bounding_box(outline, p1_res.x, p2_res.y, p2_res.x, p1_res.y);
|
||||
|
||||
vg_lite_path_t * vg_lite_path = lv_vg_lite_path_get_path(outline);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t *
|
||||
|
||||
lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32);
|
||||
lv_vg_lite_path_set_quality(path, VG_LITE_MEDIUM);
|
||||
lv_vg_lite_path_set_bonding_box_area(path, &rel_clip_area);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &rel_clip_area);
|
||||
|
||||
/* head point */
|
||||
float head_start_x = p1_x + w2_dx;
|
||||
|
||||
@@ -105,7 +105,7 @@ void lv_draw_vg_lite_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_re
|
||||
|
||||
lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32);
|
||||
lv_vg_lite_path_set_quality(path, VG_LITE_HIGH);
|
||||
lv_vg_lite_path_set_bonding_box_area(path, &draw_area);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &draw_area);
|
||||
|
||||
/* Use rounded rectangles and normal rectangles of the same size to nest the cropped area */
|
||||
lv_vg_lite_path_append_rect(path, dsc->area.x1, dsc->area.y1, w, h, dsc->radius);
|
||||
|
||||
@@ -59,7 +59,7 @@ void lv_draw_vg_lite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle
|
||||
lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)draw_unit;
|
||||
|
||||
lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32);
|
||||
lv_vg_lite_path_set_bonding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_move_to(path, dsc->p[0].x, dsc->p[0].y);
|
||||
lv_vg_lite_path_line_to(path, dsc->p[1].x, dsc->p[1].y);
|
||||
lv_vg_lite_path_line_to(path, dsc->p[2].x, dsc->p[2].y);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
/**
|
||||
* It is found that thorvg cannot handle large coordinates well.
|
||||
* When the coordinates are larger than 4096, the calculation of tvgSwRle module will overflow in 32-bit system.
|
||||
* So we use FLT_MAX and FLT_MIN to write the mark to bonding_box to tell vg_lite_tvg not to add clip path to the current path.
|
||||
* So we use FLT_MAX and FLT_MIN to write the mark to bounding_box to tell vg_lite_tvg not to add clip path to the current path.
|
||||
*/
|
||||
#define PATH_COORD_MAX FLT_MAX
|
||||
#define PATH_COORD_MIN FLT_MIN
|
||||
@@ -130,7 +130,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec
|
||||
|
||||
/* get path bounds */
|
||||
float min_x, min_y, max_x, max_y;
|
||||
lv_vg_lite_path_get_bonding_box(lv_vg_path, &min_x, &min_y, &max_x, &max_y);
|
||||
lv_vg_lite_path_get_bounding_box(lv_vg_path, &min_x, &min_y, &max_x, &max_y);
|
||||
|
||||
/* convert path type */
|
||||
vg_lite_path_type_t path_type = lv_path_opa_to_path_type(dsc);
|
||||
@@ -193,10 +193,10 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec
|
||||
/* set scissor area */
|
||||
lv_vg_lite_set_scissor_area(&dsc->scissor_area);
|
||||
|
||||
/* no bonding box */
|
||||
lv_vg_lite_path_set_bonding_box(lv_vg_path,
|
||||
(float)PATH_COORD_MIN, (float)PATH_COORD_MIN,
|
||||
(float)PATH_COORD_MAX, (float)PATH_COORD_MAX);
|
||||
/* no bounding box */
|
||||
lv_vg_lite_path_set_bounding_box(lv_vg_path,
|
||||
(float)PATH_COORD_MIN, (float)PATH_COORD_MIN,
|
||||
(float)PATH_COORD_MAX, (float)PATH_COORD_MAX);
|
||||
}
|
||||
else {
|
||||
/* calc inverse matrix */
|
||||
@@ -216,7 +216,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec
|
||||
lv_point_precise_t p2 = { dsc->scissor_area.x2 + 1, dsc->scissor_area.y2 + 1 };
|
||||
lv_point_precise_t p2_res = lv_vg_lite_matrix_transform_point(&result, &p2);
|
||||
|
||||
lv_vg_lite_path_set_bonding_box(lv_vg_path, p1_res.x, p1_res.y, p2_res.x, p2_res.y);
|
||||
lv_vg_lite_path_set_bounding_box(lv_vg_path, p1_res.x, p1_res.y, p2_res.x, p2_res.y);
|
||||
}
|
||||
|
||||
switch(dsc->fill_dsc.style) {
|
||||
@@ -392,7 +392,7 @@ static void lv_path_to_vg(lv_vg_lite_path_t * dest, const lv_vector_path_t * src
|
||||
}
|
||||
}
|
||||
|
||||
lv_vg_lite_path_set_bonding_box(dest, min_x, min_y, max_x, max_y);
|
||||
lv_vg_lite_path_set_bounding_box(dest, min_x, min_y, max_x, max_y);
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,9 +151,9 @@ vg_lite_path_t * lv_vg_lite_path_get_path(lv_vg_lite_path_t * path)
|
||||
return &path->base;
|
||||
}
|
||||
|
||||
void lv_vg_lite_path_set_bonding_box(lv_vg_lite_path_t * path,
|
||||
float min_x, float min_y,
|
||||
float max_x, float max_y)
|
||||
void lv_vg_lite_path_set_bounding_box(lv_vg_lite_path_t * path,
|
||||
float min_x, float min_y,
|
||||
float max_x, float max_y)
|
||||
{
|
||||
LV_ASSERT_NULL(path);
|
||||
path->base.bounding_box[0] = min_x;
|
||||
@@ -162,16 +162,16 @@ void lv_vg_lite_path_set_bonding_box(lv_vg_lite_path_t * path,
|
||||
path->base.bounding_box[3] = max_y;
|
||||
}
|
||||
|
||||
void lv_vg_lite_path_set_bonding_box_area(lv_vg_lite_path_t * path, const lv_area_t * area)
|
||||
void lv_vg_lite_path_set_bounding_box_area(lv_vg_lite_path_t * path, const lv_area_t * area)
|
||||
{
|
||||
LV_ASSERT_NULL(path);
|
||||
LV_ASSERT_NULL(area);
|
||||
lv_vg_lite_path_set_bonding_box(path, area->x1, area->y1, area->x2 + 1, area->y2 + 1);
|
||||
lv_vg_lite_path_set_bounding_box(path, area->x1, area->y1, area->x2 + 1, area->y2 + 1);
|
||||
}
|
||||
|
||||
void lv_vg_lite_path_get_bonding_box(lv_vg_lite_path_t * path,
|
||||
float * min_x, float * min_y,
|
||||
float * max_x, float * max_y)
|
||||
void lv_vg_lite_path_get_bounding_box(lv_vg_lite_path_t * path,
|
||||
float * min_x, float * min_y,
|
||||
float * max_x, float * max_y)
|
||||
{
|
||||
LV_ASSERT_NULL(path);
|
||||
if(min_x) *min_x = path->base.bounding_box[0];
|
||||
@@ -210,7 +210,7 @@ static void path_bounds_iter_cb(void * user_data, uint8_t op_code, const float *
|
||||
}
|
||||
}
|
||||
|
||||
bool lv_vg_lite_path_update_bonding_box(lv_vg_lite_path_t * path)
|
||||
bool lv_vg_lite_path_update_bounding_box(lv_vg_lite_path_t * path)
|
||||
{
|
||||
LV_ASSERT_NULL(path);
|
||||
|
||||
@@ -232,7 +232,7 @@ bool lv_vg_lite_path_update_bonding_box(lv_vg_lite_path_t * path)
|
||||
lv_vg_lite_path_for_each_data(lv_vg_lite_path_get_path(path), path_bounds_iter_cb, &bounds);
|
||||
|
||||
/* set bounds */
|
||||
lv_vg_lite_path_set_bonding_box(path, bounds.min_x, bounds.min_y, bounds.max_x, bounds.max_y);
|
||||
lv_vg_lite_path_set_bounding_box(path, bounds.min_x, bounds.min_y, bounds.max_x, bounds.max_y);
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
|
||||
|
||||
@@ -49,17 +49,17 @@ void lv_vg_lite_path_drop(lv_draw_vg_lite_unit_t * unit, lv_vg_lite_path_t * pat
|
||||
|
||||
void lv_vg_lite_path_reset(lv_vg_lite_path_t * path, vg_lite_format_t data_format);
|
||||
|
||||
void lv_vg_lite_path_set_bonding_box_area(lv_vg_lite_path_t * path, const lv_area_t * area);
|
||||
void lv_vg_lite_path_set_bounding_box_area(lv_vg_lite_path_t * path, const lv_area_t * area);
|
||||
|
||||
void lv_vg_lite_path_set_bonding_box(lv_vg_lite_path_t * path,
|
||||
float min_x, float min_y,
|
||||
float max_x, float max_y);
|
||||
void lv_vg_lite_path_set_bounding_box(lv_vg_lite_path_t * path,
|
||||
float min_x, float min_y,
|
||||
float max_x, float max_y);
|
||||
|
||||
void lv_vg_lite_path_get_bonding_box(lv_vg_lite_path_t * path,
|
||||
float * min_x, float * min_y,
|
||||
float * max_x, float * max_y);
|
||||
void lv_vg_lite_path_get_bounding_box(lv_vg_lite_path_t * path,
|
||||
float * min_x, float * min_y,
|
||||
float * max_x, float * max_y);
|
||||
|
||||
bool lv_vg_lite_path_update_bonding_box(lv_vg_lite_path_t * path);
|
||||
bool lv_vg_lite_path_update_bounding_box(lv_vg_lite_path_t * path);
|
||||
|
||||
void lv_vg_lite_path_set_transform(lv_vg_lite_path_t * path, const vg_lite_matrix_t * matrix);
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ void lv_vg_lite_path_dump_info(const vg_lite_path_t * path)
|
||||
|
||||
LV_LOG_USER("address: %p", (void *)path->path);
|
||||
LV_LOG_USER("length: %d", (int)len);
|
||||
LV_LOG_USER("bonding box: (%0.2f, %0.2f) - (%0.2f, %0.2f)",
|
||||
LV_LOG_USER("bounding box: (%0.2f, %0.2f) - (%0.2f, %0.2f)",
|
||||
path->bounding_box[0], path->bounding_box[1],
|
||||
path->bounding_box[2], path->bounding_box[3]);
|
||||
LV_LOG_USER("format: %d", (int)path->format);
|
||||
|
||||
Reference in New Issue
Block a user