feat(vector): draw rectangle should support minus width/height (#9716)

This commit is contained in:
Benign X
2026-02-19 17:21:57 +08:00
committed by GitHub
parent c3c1fc2178
commit 9be768db42
2 changed files with 7 additions and 3 deletions
-2
View File
@@ -389,8 +389,6 @@ void lv_vector_path_get_bounding(const lv_vector_path_t * path, lv_area_t * area
void lv_vector_path_append_rectangle(lv_vector_path_t * path, float x, float y, float w, float h, float rx, float ry)
{
if(w <= 0.0f || h <= 0.0f) return;
float hw = w * 0.5f;
float hh = h * 0.5f;
+7 -1
View File
@@ -50,7 +50,13 @@ static void draw_shapes(lv_layer_t * layer, const lv_matrix_t * transform)
lv_area_t rect1 = {50, 50, 150, 150};
lv_draw_vector_dsc_set_transform(ctx, transform);
lv_vector_path_clear(path);
lv_vector_path_append_rect(path, &rect1, 0, 0);
/*
* Regarding x=100, create two mirrored rectangles,
* using positive width and negative width respectively.
*/
lv_vector_path_append_rectangle(path, 100, 50, 51, 101, 0, 0);
lv_vector_path_append_rectangle(path, 100, 50, -50, 101, 0, 0);
lv_draw_vector_dsc_set_fill_color(ctx, lv_color_make(0xff, 0x00, 0x00));
lv_draw_vector_dsc_add_path(ctx, path);