diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-07 22:40:12 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-07 22:40:12 +0100 |
commit | 7b1e2705e409b7dc3101f54c6650a3601dfded11 (patch) | |
tree | 3808b56c70611c474d3f51936b064188115f86a1 | |
parent | a6c2659efc8f7f44066acf5d93e7fc4cadd5147a (diff) | |
download | gold-mine-run-7b1e2705e409b7dc3101f54c6650a3601dfded11.tar.gz gold-mine-run-7b1e2705e409b7dc3101f54c6650a3601dfded11.zip |
A bit faster
-rw-r--r-- | src/vga.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; } } |