Fix missing support for drawing the mouse cursor in depth 24 of direct
mode. Use the general DRAWPIXEL() macro with its bigger case statement (twice) instead of our big case statement (once). DRAWPIXEL() is more complicated since it is not missing support for depth 24 or complications for colors in depth 16 (we currently hard-code black and white so the complications for colors are not needed). DRAWPIXEL() also does the bpp calculation in the inner loop. Compilers optimize DRAWPIXEL() well enough, and the main text drawing method always depended on this. In direct mode, mouse cursor drawing is now similar to normal text drawing except it draws in 2 hard-coded colors instead of 1 variable color. This also fixes a nested hard-coding of colors. DRAWPIXEL() uses the palette in all cases, but the direct code didn't use the palette for its hard-coded black. This only had an effect in depth 8, since changing the palette is not supported in other depths.
This commit is contained in:
parent
9dc5d76e10
commit
35ffedf6bc
@ -1127,10 +1127,6 @@ vga_pxlmouse_direct(scr_stat *scp, int x, int y, int on)
|
||||
int line_width, pixel_size;
|
||||
int xend, yend;
|
||||
int i, j;
|
||||
uint32_t *u32;
|
||||
uint16_t *u16;
|
||||
uint8_t *u8;
|
||||
int bpp;
|
||||
|
||||
mdp = (scp->font_size < 14) ? &mouse9x13 : &mouse10x16;
|
||||
|
||||
@ -1144,11 +1140,6 @@ vga_pxlmouse_direct(scr_stat *scp, int x, int y, int on)
|
||||
yend <= (scp->yoff + scp->ysize) * scp->font_size)
|
||||
return;
|
||||
|
||||
bpp = scp->sc->adp->va_info.vi_depth;
|
||||
|
||||
if ((bpp == 16) && (scp->sc->adp->va_info.vi_pixel_fsizes[1] == 5))
|
||||
bpp = 15;
|
||||
|
||||
line_width = scp->sc->adp->va_line_width;
|
||||
pixel_size = scp->sc->adp->va_info.vi_pixel_size;
|
||||
|
||||
@ -1165,43 +1156,12 @@ vga_pxlmouse_direct(scr_stat *scp, int x, int y, int on)
|
||||
|
||||
do_on:
|
||||
p = scp->sc->adp->va_window + y * line_width + x * pixel_size;
|
||||
|
||||
for (i = 0; i < (yend - y); i++) {
|
||||
for (j = (xend - x - 1); j >= 0; j--) {
|
||||
switch (bpp) {
|
||||
case 32:
|
||||
u32 = (uint32_t*)(p + j * pixel_size);
|
||||
if (mdp->md_interior[i] & (1 << (15 - j)))
|
||||
writel(u32, vga_palette32[15]);
|
||||
else if (mdp->md_border[i] & (1 << (15 - j)))
|
||||
writel(u32, 0);
|
||||
break;
|
||||
case 16:
|
||||
u16 = (uint16_t*)(p + j * pixel_size);
|
||||
if (mdp->md_interior[i] & (1 << (15 - j)))
|
||||
writew(u16, vga_palette16[15]);
|
||||
else if (mdp->md_border[i] & (1 << (15 - j)))
|
||||
writew(u16, 0);
|
||||
break;
|
||||
case 15:
|
||||
u16 = (uint16_t*)(p + j * pixel_size);
|
||||
if (mdp->md_interior[i] & (1 << (15 - j)))
|
||||
writew(u16, vga_palette15[15]);
|
||||
else if (mdp->md_border[i] & (1 << (15 - j)))
|
||||
writew(u16, 0);
|
||||
break;
|
||||
case 8:
|
||||
u8 = (uint8_t*)(p + j * pixel_size);
|
||||
if (mdp->md_interior[i] & (1 << (15 - j)))
|
||||
writeb(u8, 15);
|
||||
else if (mdp->md_border[i] & (1 << (15 - j)))
|
||||
writeb(u8, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
p += line_width;
|
||||
}
|
||||
for (i = 0; i < yend - y; i++, p += line_width)
|
||||
for (j = xend - x - 1; j >= 0; j--)
|
||||
if (mdp->md_interior[i] & (1 << (15 - j)))
|
||||
DRAW_PIXEL(scp, p + j * pixel_size, 15);
|
||||
else if (mdp->md_border[i] & (1 << (15 - j)))
|
||||
DRAW_PIXEL(scp, p + j * pixel_size, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user