Module Name: src Committed By: macallan Date: Sat Jan 6 07:26:54 UTC 2018
Modified Files: src/sys/arch/sparc/dev: cgfourteen.c Log Message: support underlines To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/arch/sparc/dev/cgfourteen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/sparc/dev/cgfourteen.c diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.82 src/sys/arch/sparc/dev/cgfourteen.c:1.83 --- src/sys/arch/sparc/dev/cgfourteen.c:1.82 Fri Sep 16 22:39:35 2016 +++ src/sys/arch/sparc/dev/cgfourteen.c Sat Jan 6 07:26:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cgfourteen.c,v 1.82 2016/09/16 22:39:35 macallan Exp $ */ +/* $NetBSD: cgfourteen.c,v 1.83 2018/01/06 07:26:54 macallan Exp $ */ /* * Copyright (c) 1996 @@ -163,6 +163,7 @@ static int cg14_do_cursor(struct cgfour static void cg14_wait_idle(struct cgfourteen_softc *); static void cg14_rectfill(struct cgfourteen_softc *, int, int, int, int, uint32_t); +static void cg14_rectfill_a(void *, int, int, int, int, long); static void cg14_invert(struct cgfourteen_softc *, int, int, int, int); static void cg14_bitblt(void *, int, int, int, int, int, int, int); static void cg14_bitblt_gc(void *, int, int, int, int, int, int, int); @@ -723,7 +724,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s 0, 0, NULL, 8, 16, - WSSCREEN_WSCOLORS | WSSCREEN_HILIT, + WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE, NULL }; cg14_set_depth(sc, 8); @@ -738,6 +739,7 @@ cg14_setup_wsdisplay(struct cgfourteen_s sc->sc_gc.gc_bitblt = cg14_bitblt_gc; sc->sc_gc.gc_blitcookie = sc; + sc->sc_gc.gc_rectfill = cg14_rectfill_a; sc->sc_gc.gc_rop = 0xc; if (is_cons) { vcons_init_screen(&sc->sc_vd, &sc->sc_console_screen, 1, @@ -1008,7 +1010,7 @@ cg14_init_screen(void *cookie, struct vc ri->ri_bits = (char *)sc->sc_fb.fb_pixels; #if NSX > 0 - ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA; + ri->ri_flg |= RI_8BIT_IS_RGB | RI_ENABLE_ALPHA | RI_PREFER_ALPHA; /* * unaligned copies with horizontal overlap are slow, so don't bother @@ -1025,7 +1027,7 @@ cg14_init_screen(void *cookie, struct vc } rasops_init(ri, 0, 0); - ri->ri_caps = WSSCREEN_WSCOLORS; + ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE; rasops_reconfig(ri, sc->sc_fb.fb_type.fb_height / ri->ri_font->fontheight, @@ -1209,7 +1211,7 @@ cg14_rectfill(struct cgfourteen_softc *s cnt -= pre; } /* now do the aligned pixels in 32bit chunks */ - while(cnt > 31) { + while(cnt > 3) { words = min(32, cnt >> 2); sta(pptr & ~7, ASI_SX, SX_STS(8, words - 1, pptr & 7)); pptr += words << 2; @@ -1223,6 +1225,16 @@ cg14_rectfill(struct cgfourteen_softc *s } static void +cg14_rectfill_a(void *cookie, int dstx, int dsty, + int width, int height, long attr) +{ + struct cgfourteen_softc *sc = cookie; + + cg14_rectfill(sc, dstx, dsty, width, height, + sc->sc_vd.active->scr_ri.ri_devcmap[(attr >> 24 & 0xf)]); +} + +static void cg14_invert(struct cgfourteen_softc *sc, int x, int y, int wi, int he) { uint32_t addr, pptr; @@ -1459,17 +1471,20 @@ cg14_putchar(void *cookie, int row, int bg = ri->ri_devcmap[(attr >> 16) & 0xf]; fg = ri->ri_devcmap[(attr >> 24) & 0xf]; - sx_write(sc->sc_sx, SX_QUEUED(8), bg); - sx_write(sc->sc_sx, SX_QUEUED(9), fg); x = ri->ri_xorigin + col * wi; y = ri->ri_yorigin + row * he; if (c == 0x20) { cg14_rectfill(sc, x, y, wi, he, bg); + if (attr & 1) + cg14_rectfill(sc, x, y + he - 2, wi, 1, fg); return; } + sx_write(sc->sc_sx, SX_QUEUED(8), bg); + sx_write(sc->sc_sx, SX_QUEUED(9), fg); + data = WSFONT_GLYPH(c, font); addr = sc->sc_fb_paddr + x + stride * y; @@ -1501,6 +1516,8 @@ cg14_putchar(void *cookie, int row, int break; } } + if (attr & 1) + cg14_rectfill(sc, x, y + he - 2, wi, 1, fg); } static void @@ -1545,7 +1562,7 @@ cg14_putchar_aa(void *cookie, int row, i struct vcons_screen *scr = ri->ri_hw; struct cgfourteen_softc *sc = scr->scr_cookie; int stride = sc->sc_fb.fb_type.fb_width; - uint32_t bg, addr, bg8, fg8, pixel, in, q, next; + uint32_t bg, fg, addr, bg8, fg8, pixel, in, q, next; int i, j, x, y, wi, he, r, g, b, aval, cnt, reg; int r1, g1, b1, r0, g0, b0, fgo, bgo, rv; uint8_t *data8; @@ -1560,10 +1577,13 @@ cg14_putchar_aa(void *cookie, int row, i he = font->fontheight; bg = ri->ri_devcmap[(attr >> 16) & 0xf]; + fg = ri->ri_devcmap[(attr >> 24) & 0xf]; x = ri->ri_xorigin + col * wi; y = ri->ri_yorigin + row * he; if (c == 0x20) { cg14_rectfill(sc, x, y, wi, he, bg); + if (attr & 1) + cg14_rectfill(sc, x, y + he - 2, wi, 1, fg); return; } @@ -1641,7 +1661,9 @@ cg14_putchar_aa(void *cookie, int row, i if (rv == GC_ADD) { glyphcache_add(&sc->sc_gc, c, x, y); - } + } else if (attr & 1) + cg14_rectfill(sc, x, y + he - 2, wi, 1, fg); + } static void