improve lcd_vgcanvas_fill_rect

This commit is contained in:
lixianjing 2020-11-24 17:28:41 +08:00
parent 42aaff611f
commit 422efce8a4

View File

@ -111,19 +111,28 @@ static ret_t lcd_vgcanvas_fill_rect(lcd_t* lcd, xy_t x, xy_t y, wh_t w, wh_t h)
vgcanvas_set_antialias(canvas, TRUE);
vgcanvas_restore(canvas);
} else if (w <= 1) {
vgcanvas_save(canvas);
vgcanvas_begin_path(canvas);
vgcanvas_move_to(canvas, x + 0.5f, y);
vgcanvas_line_to(canvas, x + 0.5f, y + h);
vgcanvas_set_antialias(canvas, FALSE);
vgcanvas_translate(canvas, 0.5f, -0.5f);
vgcanvas_move_to(canvas, x, y);
vgcanvas_line_to(canvas, x, y + h);
vgcanvas_set_line_width(canvas, 1);
vgcanvas_set_stroke_color(canvas, lcd->fill_color);
vgcanvas_stroke(canvas);
vgcanvas_set_antialias(canvas, TRUE);
vgcanvas_restore(canvas);
} else if (h <= 1) {
vgcanvas_save(canvas);
vgcanvas_begin_path(canvas);
vgcanvas_move_to(canvas, x, y + 0.5f);
vgcanvas_line_to(canvas, x + w, y + 0.5f);
vgcanvas_set_antialias(canvas, FALSE);
vgcanvas_move_to(canvas, x, y);
vgcanvas_line_to(canvas, x + w, y);
vgcanvas_set_line_width(canvas, 1);
vgcanvas_set_stroke_color(canvas, lcd->fill_color);
vgcanvas_stroke(canvas);
vgcanvas_set_antialias(canvas, TRUE);
vgcanvas_restore(canvas);
}
return RET_OK;