aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-06-07 22:40:12 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-06-07 22:40:12 +0100
commit7b1e2705e409b7dc3101f54c6650a3601dfded11 (patch)
tree3808b56c70611c474d3f51936b064188115f86a1 /src
parenta6c2659efc8f7f44066acf5d93e7fc4cadd5147a (diff)
downloadgold-mine-run-7b1e2705e409b7dc3101f54c6650a3601dfded11.tar.gz
gold-mine-run-7b1e2705e409b7dc3101f54c6650a3601dfded11.zip
A bit faster
Diffstat (limited to 'src')
-rw-r--r--src/vga.c6
1 files 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;
}
}