Quick fix for removal of the mouse cursor in vga direct graphics modes

(that is, in all supported 8, 15, 16 and 24-color modes).  Moving the
mouse cursor while holding down a button (giving cut marking) left a
trail of garbage from misremoved mouse cursors (usually colored
rectangles and not cursor shapes).  Cases with a button not held down
worked better and may even have worked.

No renderer support for removing (software) mouse cursors is needed
(and many renderers don't have any), since sc_remove_mouse_image()
marks for update the region containing the image and usually much
more.  The mouse cursor can be (partially) over as many as 4 character
cells, and removing it in only the 1-4 cells occupied by it would be
best for efficiency and for avoiding flicker.  However,
sc_remove_mouse_image() can only mark a single linear region and
usually marks a full row of cells and 1 more to be sure to cover the
4 cells.  It always does this, so using the special rendering method
just wastes even more time and gives even more flicker.  The special
methods will be removed soon.

The general method always works.  vga_pxlmouse_direct() appeared to
defer to it by returning immediately if !on.  However,
vga_pxlmouse_direct() actually did foot-shooting using a disguised
saveunder method.  Normal order near a mouse move is:
  (1) remove the mouse cursor in the renderer (optional)
  (2) remove the mouse cursor again and refresh the screen over the
      mouse cursor and much more from the vtb.  When the mouse has
      actually moved and a button is down, many attributes in this
      region are changed to be up to date with the new cut marking
  (3) draw the keyboard cursor again if it was clobbered by the update
  (4) draw the mouse cursor image in its new position.
The bug was to remove the mouse cursor again in step (4), before the
drawing it again in (4), using a saveunder that was valid in step (1)
at best.  The quick fix is to use the saveunder in step (1) and not
in step (4).  Using it in step (4) also used it before it was
initialized, initially and after  mode and screen switches.
This commit is contained in:
Bruce Evans 2017-04-08 10:00:39 +00:00
parent a077708d35
commit eeab8fcc4b

View File

@ -1167,9 +1167,6 @@ vga_pxlmouse_direct(scr_stat *scp, int x, int y, int on)
uint8_t *u8;
int bpp;
if (!on)
return;
bpp = scp->sc->adp->va_info.vi_depth;
if ((bpp == 16) && (scp->sc->adp->va_info.vi_pixel_fsizes[1] == 5))
@ -1181,6 +1178,9 @@ vga_pxlmouse_direct(scr_stat *scp, int x, int y, int on)
xend = imin(x + 16, scp->xpixel);
yend = imin(y + 16, scp->ypixel);
if (on)
goto do_on;
p = scp->sc->adp->va_window + y_old * line_width + x_old * pixel_size;
for (i = 0; i < (yend_old - y_old); i++) {
@ -1205,7 +1205,9 @@ vga_pxlmouse_direct(scr_stat *scp, int x, int y, int on)
p += line_width;
}
return;
do_on:
p = scp->sc->adp->va_window + y * line_width + x * pixel_size;
for (i = 0; i < (yend - y); i++) {