From 7b1e2705e409b7dc3101f54c6650a3601dfded11 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Wed, 7 Jun 2023 22:40:12 +0100 Subject: A bit faster --- src/vga.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vga.c b/src/vga.c index f2934a4..a408f71 100644 --- a/src/vga.c +++ b/src/vga.c @@ -46,7 +46,7 @@ void set_palette(const uint8_t *palette) void blit(const uint8_t *src, uint16_t x, uint16_t y, uint16_t w, uint16_t h) { - for (int16_t j = y; j < y + h; j++) + for (int32_t j = y * 320; j < (y + h) * 320; j += 320) for (int16_t i = x; i < x + w; i++) { uint8_t b = *src++; @@ -56,10 +56,10 @@ void blit(const uint8_t *src, uint16_t x, uint16_t y, uint16_t w, uint16_t h) continue; /* clipping */ - if (i < 0 || i >= 320 || j < 0 || j >= 200) + if (i < 0 || i >= 320 || j < 0 || j >= 200 * 320) continue; - buffer[i + j * 320] = b; + buffer[i + j] = b; } } -- cgit v1.2.3