From 7d6d4d11b5e4da38b82cbad705539e64c83788cc Mon Sep 17 00:00:00 2001 From: quou Date: Sat, 27 Jul 2024 18:02:17 +1000 Subject: ren_rect --- render.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'render.c') diff --git a/render.c b/render.c index 8e74082..9eb3af0 100644 --- a/render.c +++ b/render.c @@ -211,6 +211,25 @@ void ren_point(Renderer* r, Colour c, int x, int y) { r->t[x + y * r->vp[0]] = c; } +void ren_rect(Renderer* r, Colour c, const Rect* re) { + Rect rect = *re; + Colour* d; + int s, y, ey, ex; + rect_clipr(&rect, r->clip); + d = &r->t[rect.x + rect.y * r->vp[0]]; + s = r->vp[0] - rect.w; + ex = rect.x + rect.w; + ey = rect.y + rect.h; + for (y = rect.y; y < ey; y++) { + int x; + for (x = rect.x; x < ex; x++) { + *d = blend(*d, c); + d++; + } + d += s; + } +} + #define imp_ren_char(chw, chh, fw, data) \ int i, j, k, l, ex, ey, s; \ Colour* dst; \ -- cgit v1.2.3-54-g00ecf