From e04b8e6fb4c85ff5eb124185d1713d4b463949a7 Mon Sep 17 00:00:00 2001 From: Alec Murphy Date: Mon, 21 Apr 2025 09:53:02 -0400 Subject: [PATCH] System/Libraries/Graphics2D: Use Plot2D() for HLine2D() --- System/Libraries/Graphics2D.HC | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/System/Libraries/Graphics2D.HC b/System/Libraries/Graphics2D.HC index 7aff17f..16025f6 100644 --- a/System/Libraries/Graphics2D.HC +++ b/System/Libraries/Graphics2D.HC @@ -734,12 +734,14 @@ U0 VLine2D(Context2D* ctx, I64 x, I64 y, I64 y2, U0 HLine2D(Context2D* ctx, I64 x, I64 y, I64 x2, U32 color) { // Draw a horizontal line. + if (x > ctx->width || y > ctx->height) + return; if (x2 < x) return; - I64 width = x2 - x; - - MemSetU32(ctx->fb + (y * ctx->width) + x, color, - T(x + width > ctx->width, ctx->width - x, width)); + while (x < x2 + 1) { + Plot2D(ctx, x, y, color); + x++; + } } U0 Line2D(Context2D* ctx, I64 x1, I64 y1, I64 x2, I64 y2,