diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-07-08 11:50:18 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-07-08 11:50:18 +0100 |
commit | 118e8e7db21040ad9e5e94cb824c4f389a8b5dcf (patch) | |
tree | d6616e1b936f5d1d8bd0c5dcbb02e255e5c709dc /src | |
parent | 801f31feba0c52146e7bdc73c4e751c708518564 (diff) | |
download | gold-mine-run-118e8e7db21040ad9e5e94cb824c4f389a8b5dcf.tar.gz gold-mine-run-118e8e7db21040ad9e5e94cb824c4f389a8b5dcf.zip |
Faster version with no clipping
Diffstat (limited to 'src')
-rw-r--r-- | src/vga.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -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; + } } |