diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-02-16 23:05:47 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-02-16 23:05:47 +0000 |
commit | 109070e7b315c6cd42a786145fc029c7679b73ff (patch) | |
tree | a61e743178e696529c45a9a47912e87f27a8cd89 /sys | |
parent | 78d09a35c70bfb85175af75560a1d9dfb5bfcd2b (diff) |
Use rasops_unpack_attr() to decompose attributes instead of doing it by hand,
as we are not supposed to know how rasops encodes attributes here.
Tested matthieu@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/tga.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/sys/dev/pci/tga.c b/sys/dev/pci/tga.c index b46f48fe515..01bc6c89d44 100644 --- a/sys/dev/pci/tga.c +++ b/sys/dev/pci/tga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tga.c,v 1.25 2005/10/26 19:15:43 martin Exp $ */ +/* $OpenBSD: tga.c,v 1.26 2006/02/16 23:05:46 miod Exp $ */ /* $NetBSD: tga.c,v 1.40 2002/03/13 15:05:18 ad Exp $ */ /* @@ -139,7 +139,8 @@ struct wsscreen_descr tga_stdscreen = { 0, 0, /* will be filled in -- XXX shouldn't, it's global */ &tga_emulops, 0, 0, - WSSCREEN_REVERSE + WSSCREEN_UNDERLINE | WSSCREEN_HILIT | + WSSCREEN_WSCOLORS | WSSCREEN_REVERSE }; const struct wsscreen_descr *_tga_scrlist[] = { @@ -1248,7 +1249,8 @@ tga_rop_vtov(dst, dx, dy, w, h, src, sx, sy) } -void tga_putchar (c, row, col, uc, attr) +void +tga_putchar(c, row, col, uc, attr) void *c; int row, col; u_int uc; @@ -1257,6 +1259,7 @@ void tga_putchar (c, row, col, uc, attr) struct rasops_info *ri = c; struct tga_devconfig *dc = ri->ri_hw; int fs, height, width; + int fg, bg, ul; u_char *fr; int32_t *rp; @@ -1273,8 +1276,9 @@ void tga_putchar (c, row, col, uc, attr) * The rasops code has already expanded the color entry to 32 bits * for us, even for 8-bit displays, so we don't have to do anything. */ - TGAWREG(dc, TGA_REG_GFGR, ri->ri_devcmap[(attr >> 24) & 15]); - TGAWREG(dc, TGA_REG_GBGR, ri->ri_devcmap[(attr >> 16) & 15]); + rasops_unpack_attr(attr, &fg, &bg, &ul); + TGAWREG(dc, TGA_REG_GFGR, ri->ri_devcmap[fg]); + TGAWREG(dc, TGA_REG_GBGR, ri->ri_devcmap[bg]); /* Set raster operation to "copy"... */ if (ri->ri_depth == 8) @@ -1301,7 +1305,7 @@ void tga_putchar (c, row, col, uc, attr) } /* Do underline */ - if ((attr & 1) != 0) { + if (ul) { rp = (int32_t *)((caddr_t)rp - (ri->ri_stride << 1)); *rp = 0xffffffff; } @@ -1309,7 +1313,6 @@ void tga_putchar (c, row, col, uc, attr) /* Set grapics mode back to normal. */ TGAWREG(dc, TGA_REG_GMOR, 0); TGAWREG(dc, TGA_REG_GPXR_P, 0xffffffff); - } void @@ -1321,9 +1324,11 @@ tga_eraserows(c, row, num, attr) struct rasops_info *ri = c; struct tga_devconfig *dc = ri->ri_hw; int32_t color, lines, pixels; + int fg, bg; int32_t *rp; - color = ri->ri_devcmap[(attr >> 16) & 15]; + rasops_unpack_attr(attr, &fg, &bg, NULL); + color = ri->ri_devcmap[bg]; rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale); lines = num * ri->ri_font->fontheight; pixels = ri->ri_emuwidth - 1; @@ -1375,9 +1380,11 @@ tga_erasecols (c, row, col, num, attr) struct rasops_info *ri = c; struct tga_devconfig *dc = ri->ri_hw; int32_t color, lines, pixels; + int fg, bg; int32_t *rp; - color = ri->ri_devcmap[(attr >> 16) & 15]; + rasops_unpack_attr(attr, &fg, &bg, NULL); + color = ri->ri_devcmap[bg]; rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale); lines = ri->ri_font->fontheight; pixels = (num * ri->ri_font->fontwidth) - 1; |