diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index 627eded961888cb0fe258eb4abf8786e75f8aa1d..2993e6b05c442aeb88cb04366a16d2856ce87e19 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -278,6 +278,7 @@ bitmap_vmem_puttext_locked(int sx, int sy, int ex, int ey, struct vmem_cell *fil int x,y; struct vmem_cell *vc; struct vmem_cell *fi = fill; + bool fullredraw = false; if(!bitmap_initialized) return(0); @@ -297,16 +298,27 @@ bitmap_vmem_puttext_locked(int sx, int sy, int ex, int ey, struct vmem_cell *fil for(y=sy-1;y<ey;y++) { vc = vmem_cell_ptr(vstat.vmem, sx - 1, y); for(x=sx-1;x<ex;x++) { + if (vstat.mode == PRESTEL_40X24 && ((vc->bg & 0x02000000) || (fi->bg & 0x02000000))) { + if ((vc->bg & 0x01000000) != (fi->bg & 0x01000000)) { + // *ANY* change to double-height potentially changes + // *EVERY* character on the screen + fullredraw = true; + } + } *vc = *(fi++); - if (vstat.mode == PRESTEL_40X24 && (vc->bg & 0x02000000) && (vc->legacy_attr & 0x08)) { - if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) - vc->fg |= 0x01000000; - else - vc->fg &= ~0x01000000; + if (vstat.mode == PRESTEL_40X24 && (vc->bg & 0x02000000)) { + if (vc->legacy_attr & 0x08) { + if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) + vc->fg |= 0x01000000; + else + vc->fg &= ~0x01000000; + } } vc = vmem_next_ptr(vstat.vmem, vc); } } + if (fullredraw) + request_redraw_locked(); return(1); } @@ -334,11 +346,26 @@ set_vmem_cell(size_t x, size_t y, uint16_t cell, uint32_t fg, uint32_t bg) vc->legacy_attr = cell >> 8; vc->ch = cell & 0xff; vc->fg = fg; - if (vstat.mode == PRESTEL_40X24 && (vc->bg & 0x02000000) && (vc->legacy_attr & 0x08)) { - if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) - vc->fg |= 0x01000000; - else - vc->fg &= ~0x01000000; + if (vstat.mode == PRESTEL_40X24 && ((vc->bg & 0x02000000) || (bg & 0x02000000))) { + if (vc->legacy_attr & 0x08) { + if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) + vc->fg |= 0x01000000; + else + vc->fg &= ~0x01000000; + } + if ((vc->bg & 0x01000000) != (bg & 0x01000000)) { + // *ANY* change to double-height potentially changes + // *EVERY* character on the screen + request_redraw_locked(); + } + } + if (vstat.mode == PRESTEL_40X24 && (vc->bg & 0x02000000)) { + if (vc->legacy_attr & 0x08) { + if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) + vc->fg |= 0x01000000; + else + vc->fg &= ~0x01000000; + } } vc->bg = bg; vc->font = font; @@ -1080,6 +1107,7 @@ same_cell(struct vmem_cell *bitmap_cell, struct vmem_cell *c2) return false; if (bitmap_cell->bg != c2->bg) return false; + // Handles reveal/unreveal updates, modifies vmem if (vstat.mode == PRESTEL_40X24 && (c2->bg & 0x02000000)) { if (c2->legacy_attr & 0x08) { if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL)