Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci use alternate font if available ( for autogenera...



details:   https://anonhg.NetBSD.org/src/rev/0aeb952418e1
branches:  trunk
changeset: 754557:0aeb952418e1
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue May 04 05:00:33 2010 +0000

description:
use alternate font if available ( for autogenerated box drawing characters )

diffstat:

 sys/dev/pci/chipsfb.c   |  17 +++++++++--------
 sys/dev/pci/pm2fb.c     |  16 ++++++++--------
 sys/dev/pci/radeonfb.c  |  33 ++++++++++++++++++++-------------
 sys/dev/pci/voodoofb.c  |  20 ++++++++++----------
 sys/dev/pci/voyagerfb.c |  16 ++++++++--------
 5 files changed, 55 insertions(+), 47 deletions(-)

diffs (truncated from 301 to 300 lines):

diff -r 1912faf9aa20 -r 0aeb952418e1 sys/dev/pci/chipsfb.c
--- a/sys/dev/pci/chipsfb.c     Tue May 04 04:57:34 2010 +0000
+++ b/sys/dev/pci/chipsfb.c     Tue May 04 05:00:33 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chipsfb.c,v 1.20 2009/08/20 02:40:57 macallan Exp $    */
+/*     $NetBSD: chipsfb.c,v 1.21 2010/05/04 05:00:33 macallan Exp $    */
 
 /*
  * Copyright (c) 2006 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.20 2009/08/20 02:40:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.21 2010/05/04 05:00:33 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -682,6 +682,7 @@
 chipsfb_putchar(void *cookie, int row, int col, u_int c, long attr)
 {
        struct rasops_info *ri = cookie;
+       struct wsdisplay_font *font = PICK_FONT(ri, c);
        struct vcons_screen *scr = ri->ri_hw;
        struct chipsfb_softc *sc = scr->scr_cookie;
 
@@ -694,10 +695,10 @@
                int fg, bg, uc;
                int x, y, wi, he;
 
-               wi = ri->ri_font->fontwidth;
-               he = ri->ri_font->fontheight;
+               wi = font->fontwidth;
+               he = font->fontheight;
 
-               if (!CHAR_IN_FONT(c, ri->ri_font))
+               if (!CHAR_IN_FONT(c, font))
                        return;
                bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
                fg = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
@@ -706,11 +707,11 @@
                if (c == 0x20) {
                        chipsfb_rectfill(sc, x, y, wi, he, bg);
                } else {
-                       uc = c-ri->ri_font->firstchar;
-                       data = (uint8_t *)ri->ri_font->data + uc *
+                       uc = c - font->firstchar;
+                       data = (uint8_t *)font->data + uc *
                            ri->ri_fontscale;
                        chipsfb_setup_mono(sc, x, y, wi, he, fg, bg);
-                       chipsfb_feed(sc, ri->ri_font->stride * he, data);
+                       chipsfb_feed(sc, font->stride * he, data);
                }
        }
 }
diff -r 1912faf9aa20 -r 0aeb952418e1 sys/dev/pci/pm2fb.c
--- a/sys/dev/pci/pm2fb.c       Tue May 04 04:57:34 2010 +0000
+++ b/sys/dev/pci/pm2fb.c       Tue May 04 05:00:33 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pm2fb.c,v 1.3 2010/03/16 21:27:02 macallan Exp $       */
+/*     $NetBSD: pm2fb.c,v 1.4 2010/05/04 05:00:33 macallan Exp $       */
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.3 2010/03/16 21:27:02 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.4 2010/05/04 05:00:33 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -676,6 +676,7 @@
 pm2fb_putchar(void *cookie, int row, int col, u_int c, long attr)
 {
        struct rasops_info *ri = cookie;
+       struct wsdisplay_font *font = PICK_FONT(ri, c);
        struct vcons_screen *scr = ri->ri_hw;
        struct pm2fb_softc *sc = scr->scr_cookie;
        uint32_t mode;
@@ -686,10 +687,10 @@
                int uc, i;
                int x, y, wi, he;
 
-               wi = ri->ri_font->fontwidth;
-               he = ri->ri_font->fontheight;
+               wi = font->fontwidth;
+               he = font->fontheight;
 
-               if (!CHAR_IN_FONT(c, ri->ri_font))
+               if (!CHAR_IN_FONT(c, font))
                        return;
                bg = ri->ri_devcmap[(attr >> 16) & 0xf];
                fg = ri->ri_devcmap[(attr >> 24) & 0xf];
@@ -698,9 +699,8 @@
                if (c == 0x20) {
                        pm2fb_rectfill(sc, x, y, wi, he, bg);
                } else {
-                       uc = c - ri->ri_font->firstchar;
-                       data = (uint8_t *)ri->ri_font->data + uc * 
-                           ri->ri_fontscale;
+                       uc = c - font->firstchar;
+                       data = (uint8_t *)font->data + uc * ri->ri_fontscale;
 
                        mode = PM2RM_MASK_MIRROR;
                        switch (ri->ri_font->stride) {
diff -r 1912faf9aa20 -r 0aeb952418e1 sys/dev/pci/radeonfb.c
--- a/sys/dev/pci/radeonfb.c    Tue May 04 04:57:34 2010 +0000
+++ b/sys/dev/pci/radeonfb.c    Tue May 04 05:00:33 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeonfb.c,v 1.34 2009/07/23 07:21:45 macallan Exp $ */
+/*     $NetBSD: radeonfb.c,v 1.35 2010/05/04 05:00:33 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.34 2009/07/23 07:21:45 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.35 2010/05/04 05:00:33 macallan Exp $");
 
 #define RADEONFB_DEFAULT_DEPTH 32
 
@@ -220,7 +220,7 @@
        0, 0,           /* ncols, nrows */
        NULL,           /* textops */
        8, 16,          /* fontwidth, fontheight */
-       WSSCREEN_WSCOLORS, /* capabilities */
+       WSSCREEN_WSCOLORS | WSSCREEN_REVERSE, /* capabilities */
        0,              /* modecookie */
 };
 
@@ -2169,7 +2169,7 @@
         * XXX: font selection should be based on properties, with some
         * normal/reasonable default.
         */
-       ri->ri_caps = WSSCREEN_WSCOLORS;
+       ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
 
        /* initialize and look for an initial font */
        rasops_init(ri, dp->rd_virty/8, dp->rd_virtx/8);
@@ -2348,21 +2348,28 @@
        struct rasops_info      *ri = cookie;
        struct vcons_screen     *scr = ri->ri_hw;
        struct radeonfb_display *dp = scr->scr_cookie;
+       struct wsdisplay_font   *font = PICK_FONT(ri, c);
        uint32_t                x, y, w, h;
-       uint32_t                bg, fg;
+       uint32_t                bg, fg, flg;
        uint8_t                 *data;
 
        if (dp->rd_wsmode != WSDISPLAYIO_MODE_EMUL)
                return;
 
-       if (!CHAR_IN_FONT(c, ri->ri_font))
+       if (!CHAR_IN_FONT(c, font))
                return;
 
-       w = ri->ri_font->fontwidth;
-       h = ri->ri_font->fontheight;
-
-       bg = ri->ri_devcmap[(attr >> 16) & 0xf];
-       fg = ri->ri_devcmap[(attr >> 24) & 0xf];
+       w = font->fontwidth;
+       h = font->fontheight;
+
+       flg = attr & 0xff;
+       if (flg & WSATTR_REVERSE) {
+               fg = ri->ri_devcmap[(attr >> 16) & 0xf];
+               bg = ri->ri_devcmap[(attr >> 24) & 0xf];
+       } else {
+               bg = ri->ri_devcmap[(attr >> 16) & 0xf];
+               fg = ri->ri_devcmap[(attr >> 24) & 0xf];
+       }
 
        x = ri->ri_xorigin + col * w;
        y = ri->ri_yorigin + row * h;
@@ -2370,8 +2377,8 @@
        if (c == 0x20) {
                radeonfb_rectfill(dp, x, y, w, h, bg);
        } else {
-               data = (uint8_t *)ri->ri_font->data +
-                   (c - ri->ri_font->firstchar) * ri->ri_fontscale;
+               data = (uint8_t *)font->data +
+                   (c - font->firstchar) * ri->ri_fontscale;
 
                radeonfb_setup_mono(dp, x, y, w, h, fg, bg);
                radeonfb_feed_bytes(dp, ri->ri_fontscale, data);
diff -r 1912faf9aa20 -r 0aeb952418e1 sys/dev/pci/voodoofb.c
--- a/sys/dev/pci/voodoofb.c    Tue May 04 04:57:34 2010 +0000
+++ b/sys/dev/pci/voodoofb.c    Tue May 04 05:00:33 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: voodoofb.c,v 1.21 2009/11/26 15:17:10 njoly Exp $      */
+/*     $NetBSD: voodoofb.c,v 1.22 2010/05/04 05:00:33 macallan Exp $   */
 
 /*
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.21 2009/11/26 15:17:10 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.22 2010/05/04 05:00:33 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -670,6 +670,7 @@
 voodoofb_putchar(void *cookie, int row, int col, u_int c, long attr)
 {
        struct rasops_info *ri = cookie;
+       struct wsdisplay_font *font = PICK_FONT(ri, c);
        struct vcons_screen *scr = ri->ri_hw;
        struct voodoofb_softc *sc = scr->scr_cookie;
 
@@ -678,10 +679,10 @@
                int fg, bg, uc, i;
                int x, y, wi, he;
 
-               wi = ri->ri_font->fontwidth;
-               he = ri->ri_font->fontheight;
+               wi = font->fontwidth;
+               he = font->fontheight;
 
-               if (!CHAR_IN_FONT(c, ri->ri_font))
+               if (!CHAR_IN_FONT(c, font))
                        return;
                bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
                fg = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
@@ -690,14 +691,13 @@
                if (c == 0x20) {
                        voodoofb_rectfill(sc, x, y, wi, he, bg);
                } else {
-                       uc = c-ri->ri_font->firstchar;
-                       data = (uint8_t *)ri->ri_font->data + uc * 
+                       uc = c - font->firstchar;
+                       data = (uint8_t *)font->data + uc * 
                            ri->ri_fontscale;
                                voodoofb_setup_mono(sc, x, y, wi, he, fg, bg);          
                        for (i = 0; i < he; i++) {
-                               voodoofb_feed_line(sc, 
-                                   ri->ri_font->stride, data);
-                               data += ri->ri_font->stride;
+                               voodoofb_feed_line(sc, font->stride, data);
+                               data += font->stride;
                        }
                }
        }
diff -r 1912faf9aa20 -r 0aeb952418e1 sys/dev/pci/voyagerfb.c
--- a/sys/dev/pci/voyagerfb.c   Tue May 04 04:57:34 2010 +0000
+++ b/sys/dev/pci/voyagerfb.c   Tue May 04 05:00:33 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: voyagerfb.c,v 1.2 2009/08/20 02:40:57 macallan Exp $   */
+/*     $NetBSD: voyagerfb.c,v 1.3 2010/05/04 05:00:33 macallan Exp $   */
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.2 2009/08/20 02:40:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.3 2010/05/04 05:00:33 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -679,6 +679,7 @@
 voyagerfb_putchar(void *cookie, int row, int col, u_int c, long attr)
 {
        struct rasops_info *ri = cookie;
+       struct wsdisplay_font *font = PICK_FONT(ri, c);
        struct vcons_screen *scr = ri->ri_hw;
        struct voyagerfb_softc *sc = scr->scr_cookie;
        uint32_t cmd;
@@ -687,10 +688,10 @@
                int fg, bg, uc;
                uint8_t *data;
                int x, y, wi, he;
-               wi = ri->ri_font->fontwidth;
-               he = ri->ri_font->fontheight;
+               wi = font->fontwidth;
+               he = font->fontheight;
 
-               if (!CHAR_IN_FONT(c, ri->ri_font))
+               if (!CHAR_IN_FONT(c, font))
                        return;
                bg = ri->ri_devcmap[(attr >> 16) & 0x0f];
                fg = ri->ri_devcmap[(attr >> 24) & 0x0f];
@@ -699,9 +700,8 @@
                if (c == 0x20) {
                        voyagerfb_rectfill(sc, x, y, wi, he, bg);
                } else {
-                       uc = c - ri->ri_font->firstchar;
-                       data = (uint8_t *)ri->ri_font->data + uc * 
-                           ri->ri_fontscale;
+                       uc = c - font->firstchar;
+                       data = (uint8_t *)font->data + uc * ri->ri_fontscale;
                        cmd = ROP_COPY |
                              SM502_CTRL_USE_ROP2 |



Home | Main Index | Thread Index | Old Index