Change the drawing method for the mouse cursor in planar mode to support

colors.

Colors are still hard-coded as 15 (normally lightwhite) for the interior
and 0 (normally black) for the border, but these are now values used in
2 expressions instead of built in to the algorithm.  The algorithm used
a fancy and/or method, but this gives no control over the colors except
and'ing all color planes off gives black and or'ing all color planes on
gives lightwhite.  Just draw the border and interior in separate colors
using the same method as for characters, including its complications to
optimize for VGA adaptors.  Optimization is not really needed here, but
for the VGA case it avoids being slower than the and/or method.  The
optimization is worth about 30%.
This commit is contained in:
Bruce Evans 2017-04-23 08:59:35 +00:00
parent 25ada63736
commit bfbcb15f76
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317334

View File

@ -1009,23 +1009,34 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y)
yoff = y - rounddown(y, line_width);
ymax = imin(y + mdp->md_height, scp->ypixel);
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
outw(GDCIDX, 0x0001); /* set/reset enable */
outw(GDCIDX, 0xff08); /* bit mask */
outw(GDCIDX, 0x0803); /* data rotate/function select (and) */
if (scp->sc->adp->va_type == KD_VGA) {
outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */
outw(GDCIDX, 0xff08); /* bit mask */
} else
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
outw(GDCIDX, 0x0003); /* data rotate/function select */
outw(GDCIDX, 0x0f01); /* set/reset enable */
outw(GDCIDX, (0 << 8) | 0x00); /* set/reset */
p = scp->sc->adp->va_window + line_width*y + x/8;
for (i = y, j = 0; i < ymax; ++i, ++j) {
m = ~(mdp->md_border[j] << 8 >> xoff);
m = mdp->md_border[j] << 8 >> xoff;
for (k = 0; k < 3; ++k) {
m1 = m >> (8 * (2 - k));
if (m1 != 0xff && x + 8 * k < scp->xpixel) {
if (m1 != 0 && x + 8 * k < scp->xpixel) {
readb(p + k);
writeb(p + k, m1);
}
if (scp->sc->adp->va_type == KD_VGA)
writeb(p + k, m1);
else {
/* bit mask: */
outw(GDCIDX, (m1 << 8) | 0x08);
writeb(p + k, 0);
}
}
}
p += line_width;
}
outw(GDCIDX, 0x1003); /* data rotate/function select (or) */
outw(GDCIDX, (15 << 8) | 0x00); /* set/reset */
p = scp->sc->adp->va_window + line_width*y + x/8;
for (i = y, j = 0; i < ymax; ++i, ++j) {
m = mdp->md_interior[j] << 8 >> xoff;
@ -1033,12 +1044,23 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y)
m1 = m >> (8 * (2 - k));
if (m1 != 0 && x + 8 * k < scp->xpixel) {
readb(p + k);
writeb(p + k, m1);
if (scp->sc->adp->va_type == KD_VGA)
writeb(p + k, m1);
else {
/* bit mask: */
outw(GDCIDX, (m1 << 8) | 0x08);
writeb(p + k, 0);
}
}
}
p += line_width;
}
outw(GDCIDX, 0x0003); /* data rotate/function select */
if (scp->sc->adp->va_type == KD_VGA)
outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */
else
outw(GDCIDX, 0xff08); /* bit mask */
outw(GDCIDX, 0x0000); /* set/reset */
outw(GDCIDX, 0x0001); /* set/reset enable */
}
static void