diff options
author | Ian Moffett <ian@osmora.org> | 2025-08-05 00:16:47 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-08-05 00:29:29 -0400 |
commit | 1d7061dcb3b49b7a334881deccd9c7bb0695adbf (patch) | |
tree | f007888cdb08293d722618a3b6c40c6807b71789 | |
parent | 1da5b911bc3280239d4be4d3c6002c8c7a40c74e (diff) |
lib: libgfx: Simplify gfx_draw_square()
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | lib/libgfx/src/draw.c | 11 |
1 files 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; |