From 118e8e7db21040ad9e5e94cb824c4f389a8b5dcf Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 8 Jul 2023 11:50:18 +0100 Subject: Faster version with no clipping --- src/vga.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/vga.c b/src/vga.c index 1190b6e..df79c7c 100644 --- a/src/vga.c +++ b/src/vga.c @@ -158,17 +158,12 @@ void blit_update() void read_buffer(uint8_t *dst, const Rect *src) { - for (int32_t j = src->y * 320; j < (src->y + src->h) * 320; j += 320) - for (int16_t i = src->x; i < src->x + src->w; i++) - { - uint8_t b; - - /* clipping */ - if (i < 0 || i >= 320 || j < 0 || j >= 200 * 320) - b = TRANSPARENT; - else - b = buffer[i + j]; + uint8_t *s = buffer + src->y * 320 + src->x; - *dst++ = b; - } + for (int8_t j = 0; j < src->h; j++) + { + memcpy(dst, s, src->w); + dst += src->w; + s += 320; + } } -- cgit v1.2.3