From 1d7061dcb3b49b7a334881deccd9c7bb0695adbf Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 5 Aug 2025 00:16:47 -0400 Subject: lib: libgfx: Simplify gfx_draw_square() Signed-off-by: Ian Moffett --- lib/libgfx/src/draw.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/libgfx/src/draw.c b/lib/libgfx/src/draw.c index a0061b9..870b543 100644 --- a/lib/libgfx/src/draw.c +++ b/lib/libgfx/src/draw.c @@ -75,6 +75,7 @@ static int gfx_draw_square(struct gfx_ctx *ctx, const struct gfx_shape *shape) { struct fbattr fbdev; + struct gfx_point p; off_t idx; scrpos_t x, y; @@ -84,12 +85,10 @@ gfx_draw_square(struct gfx_ctx *ctx, const struct gfx_shape *shape) for (x = shape->x; x < shape->x + shape->width; ++x) { for (y = shape->y; y < shape->y + shape->height; ++y) { - if (gfx_pixel_bounds(ctx, x, y) < 0) { - break; - } - - idx = gfx_io_index(ctx, x, y); - ctx->io[idx] = shape->color; + p.x = x; + p.y = y; + p.rgb = shape->color; + gfx_plot_point(ctx, &p); } } return 0; -- cgit v1.2.3