aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2022-04-03 21:41:22 +0200
committerJavier <dev.git@javispedro.com>2022-04-03 21:41:22 +0200
commit68979e8afd471f16c5a39888fbeaa23c2240651e (patch)
tree053d25f84e436b2b58fa34af1c3e3ba466d40441
parenta5abb118e0e61587adfa7b4e4cc72948311381d3 (diff)
downloadvbados-68979e8afd471f16c5a39888fbeaa23c2240651e.tar.gz
vbados-68979e8afd471f16c5a39888fbeaa23c2240651e.zip
write full bytes instead of pixels
-rw-r--r--dostsr.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/dostsr.c b/dostsr.c
index 0d24248..f281d8a 100644
--- a/dostsr.c
+++ b/dostsr.c
@@ -226,6 +226,7 @@ static void show_graphic_cursor(void)
uint16_t cursor_xor_mask = get_graphic_cursor_xor_mask_line(offset.y + y)
<< offset.x;
uint8_t pixel_mask = msb_pixel_mask;
+ uint8_t pixel = *line;
unsigned x;
// First, backup this scanline to prev before any changes
@@ -240,23 +241,19 @@ static void show_graphic_cursor(void)
}
for (x = 0; x < size.x; x++) {
- uint8_t pixel = *line;
-
if (!(cursor_and_mask & MSB_MASK)) {
pixel &= ~pixel_mask;
}
if (cursor_xor_mask & MSB_MASK) {
pixel ^= pixel_mask;
}
- if (!(cursor_and_mask & MSB_MASK) || (cursor_xor_mask & MSB_MASK)) {
- *line = pixel;
- }
// Advance to the next pixel
pixel_mask >>= info->bits_per_pixel;
if (!pixel_mask) {
// Time to advance to the next byte
- line++;
+ *line = pixel; // Save current byte first
+ pixel = *(++line);
pixel_mask = msb_pixel_mask;
}
@@ -264,6 +261,11 @@ static void show_graphic_cursor(void)
cursor_and_mask <<= 1;
cursor_xor_mask <<= 1;
}
+
+ if (pixel_mask != msb_pixel_mask) {
+ // We ended up in the middle of a byte, save it
+ *line = pixel;
+ }
}
}