Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/dev support underlines



details:   https://anonhg.NetBSD.org/src/rev/c84476a3a173
branches:  trunk
changeset: 828830:c84476a3a173
user:      macallan <macallan%NetBSD.org@localhost>
date:      Sat Jan 06 07:26:54 2018 +0000

description:
support underlines

diffstat:

 sys/arch/sparc/dev/cgfourteen.c |  40 +++++++++++++++++++++++++++++++---------
 1 files changed, 31 insertions(+), 9 deletions(-)

diffs (144 lines):

diff -r af0dc262373f -r c84476a3a173 sys/arch/sparc/dev/cgfourteen.c
--- a/sys/arch/sparc/dev/cgfourteen.c   Fri Jan 05 20:51:13 2018 +0000
+++ b/sys/arch/sparc/dev/cgfourteen.c   Sat Jan 06 07:26:54 2018 +0000
@@ -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 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 @@
                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 @@
 
        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 @@
 
        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 @@
        }
 
        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 @@
                        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 @@
 }
 
 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 @@
 
        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 @@
                        break;
                }
        }
+       if (attr & 1)
+               cg14_rectfill(sc, x, y + he - 2, wi, 1, fg);
 }
 
 static void
@@ -1545,7 +1562,7 @@
        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 @@
        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 @@
 
        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



Home | Main Index | Thread Index | Old Index