Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev use box drawing font if needed
details: https://anonhg.NetBSD.org/src/rev/181dfe49744d
branches: trunk
changeset: 754560:181dfe49744d
user: macallan <macallan%NetBSD.org@localhost>
date: Tue May 04 05:10:25 2010 +0000
description:
use box drawing font if needed
diffstat:
sys/dev/sbus/p9100.c | 19 ++++++++++---------
sys/dev/sbus/tcx.c | 42 +++++++++++++++++++++---------------------
sys/dev/sbus/zx.c | 16 +++++++---------
sys/dev/sun/cgsix.c | 19 ++++++++++---------
4 files changed, 48 insertions(+), 48 deletions(-)
diffs (288 lines):
diff -r 691631d7486d -r 181dfe49744d sys/dev/sbus/p9100.c
--- a/sys/dev/sbus/p9100.c Tue May 04 05:08:01 2010 +0000
+++ b/sys/dev/sbus/p9100.c Tue May 04 05:10:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $ */
+/* $NetBSD: p9100.c,v 1.55 2010/05/04 05:10:25 macallan Exp $ */
/*-
* Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.55 2010/05/04 05:10:25 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1085,6 +1085,7 @@
p9100_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 p9100_softc *sc = scr->scr_cookie;
@@ -1092,10 +1093,10 @@
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 = (u_char)ri->ri_devcmap[(attr >> 16) & 0xff];
@@ -1106,15 +1107,15 @@
if (c == 0x20) {
p9100_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;
p9100_setup_mono(sc, x, y, wi, 1, fg, bg);
for (i = 0; i < he; i++) {
- p9100_feed_line(sc, ri->ri_font->stride,
+ p9100_feed_line(sc, font->stride,
data);
- data += ri->ri_font->stride;
+ data += font->stride;
}
}
}
diff -r 691631d7486d -r 181dfe49744d sys/dev/sbus/tcx.c
--- a/sys/dev/sbus/tcx.c Tue May 04 05:08:01 2010 +0000
+++ b/sys/dev/sbus/tcx.c Tue May 04 05:10:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcx.c,v 1.42 2009/09/17 16:39:48 tsutsui Exp $ */
+/* $NetBSD: tcx.c,v 1.43 2010/05/04 05:10:25 macallan Exp $ */
/*
* Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.42 2009/09/17 16:39:48 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.43 2010/05/04 05:10:25 macallan Exp $");
/*
* define for cg8 emulation on S24 (24-bit version of tcx) for the SS5;
@@ -931,6 +931,7 @@
tcx_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 tcx_softc *sc = scr->scr_cookie;
uint64_t bg, fg, temp, mask;
@@ -939,18 +940,17 @@
uint8_t *cdata;
uint16_t *wdata;
- addr = ri->ri_xorigin +
- col * ri->ri_font->fontwidth +
- (ri->ri_yorigin + row * ri->ri_font->fontheight) * ri->ri_width;
+ addr = ri->ri_xorigin + col * font->fontwidth +
+ (ri->ri_yorigin + row * font->fontheight) * ri->ri_width;
/* check if the character is crossing a 32 pixel boundary */
if ((addr & 0xffffe0) ==
- ((addr + ri->ri_font->fontwidth - 1) & 0xffffe0)) {
+ ((addr + font->fontwidth - 1) & 0xffffe0)) {
/* phew, not split */
shift = addr & 0x1f;
addr &= 0xffffe0;
- fmask = 0xffffffff >> (32 - ri->ri_font->fontwidth);
- fmask = fmask << (32 - ri->ri_font->fontwidth - shift);
+ fmask = 0xffffffff >> (32 - font->fontwidth);
+ fmask = fmask << (32 - font->fontwidth - shift);
mask = fmask;
bg = 0x3000000000000000LL |
((uint64_t)ri->ri_devcmap[(attr >> 16) & 0xff] &
@@ -959,12 +959,12 @@
temp = 0x3000000000000000LL |
((uint64_t)ri->ri_devcmap[(attr >> 24) & 0xff] & 0xff) <<
32;
- uc = c - ri->ri_font->firstchar;
- cdata = (uint8_t *)ri->ri_font->data + uc * ri->ri_fontscale;
+ uc = c - font->firstchar;
+ cdata = (uint8_t *)font->data + uc * ri->ri_fontscale;
- if (ri->ri_font->fontwidth < 9) {
+ if (font->fontwidth < 9) {
/* byte by byte */
- for (i = 0; i < ri->ri_font->fontheight; i++) {
+ for (i = 0; i < font->fontheight; i++) {
sc->sc_rstip[addr] = bg;
if (*cdata != 0) {
if (shift > 24) {
@@ -979,10 +979,10 @@
cdata++;
addr += ri->ri_width;
}
- } else if (ri->ri_font->fontwidth < 17) {
+ } else if (font->fontwidth < 17) {
/* short by short */
wdata = (uint16_t *)cdata;
- for (i = 0; i < ri->ri_font->fontheight; i++) {
+ for (i = 0; i < font->fontheight; i++) {
sc->sc_rstip[addr] = bg;
if (*wdata != 0) {
if (shift > 16) {
@@ -1007,7 +1007,7 @@
addr &= 0xffffe0;
mask = 0xffffffff >> shift;
maskr = (uint64_t)(0xffffffffUL <<
- (32 - (ri->ri_font->fontwidth + shift - 32)));
+ (32 - (font->fontwidth + shift - 32)));
bg = 0x3000000000000000LL |
((uint64_t)ri->ri_devcmap[(attr >> 16) & 0xff] &
0xff) << 32;
@@ -1017,12 +1017,12 @@
((uint64_t)ri->ri_devcmap[(attr >> 24) & 0xff] & 0xff) <<
32;
- uc = c - ri->ri_font->firstchar;
- cdata = (uint8_t *)ri->ri_font->data + uc * ri->ri_fontscale;
+ uc = c - font->firstchar;
+ cdata = (uint8_t *)font->data + uc * ri->ri_fontscale;
- if (ri->ri_font->fontwidth < 9) {
+ if (font->fontwidth < 9) {
/* byte by byte */
- for (i = 0; i < ri->ri_font->fontheight; i++) {
+ for (i = 0; i < font->fontheight; i++) {
sc->sc_rstip[addr] = bg;
sc->sc_rstip[addr + 32] = bgr;
bork = *cdata;
@@ -1035,10 +1035,10 @@
cdata++;
addr += ri->ri_width;
}
- } else if (ri->ri_font->fontwidth < 17) {
+ } else if (font->fontwidth < 17) {
/* short by short */
wdata = (uint16_t *)cdata;
- for (i = 0; i < ri->ri_font->fontheight; i++) {
+ for (i = 0; i < font->fontheight; i++) {
sc->sc_rstip[addr] = bg;
sc->sc_rstip[addr + 32] = bgr;
bork = *wdata;
diff -r 691631d7486d -r 181dfe49744d sys/dev/sbus/zx.c
--- a/sys/dev/sbus/zx.c Tue May 04 05:08:01 2010 +0000
+++ b/sys/dev/sbus/zx.c Tue May 04 05:10:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: zx.c,v 1.35 2010/01/05 05:04:38 macallan Exp $ */
+/* $NetBSD: zx.c,v 1.36 2010/05/04 05:10:25 macallan Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.35 2010/01/05 05:04:38 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.36 2010/05/04 05:10:25 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -993,9 +993,9 @@
zx_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri = cookie;
+ struct wsdisplay_font *font = PICK_FONT(ri, uc);
struct vcons_screen *scr = ri->ri_hw;
struct zx_softc *sc = scr->scr_cookie;
- struct wsdisplay_font *font;
volatile uint32_t *dp;
uint8_t *fb;
int fs, i, ul;
@@ -1007,15 +1007,13 @@
if (uc == ' ') {
int x, y;
- x = ri->ri_xorigin + ri->ri_font->fontwidth * col;
- y = ri->ri_yorigin + ri->ri_font->fontheight * row;
- zx_fillrect(sc, x, y, ri->ri_font->fontwidth,
- ri->ri_font->fontheight, bg, ZX_STD_ROP);
+ x = ri->ri_xorigin + font->fontwidth * col;
+ y = ri->ri_yorigin + font->fontheight * row;
+ zx_fillrect(sc, x, y, font->fontwidth,
+ font->fontheight, bg, ZX_STD_ROP);
return;
}
- font = ri->ri_font;
-
dp = (volatile uint32_t *)sc->sc_pixels +
((row * font->fontheight + ri->ri_yorigin) << 11) +
(col * font->fontwidth + ri->ri_xorigin);
diff -r 691631d7486d -r 181dfe49744d sys/dev/sun/cgsix.c
--- a/sys/dev/sun/cgsix.c Tue May 04 05:08:01 2010 +0000
+++ b/sys/dev/sun/cgsix.c Tue May 04 05:10:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgsix.c,v 1.46 2009/09/19 07:07:43 tsutsui Exp $ */
+/* $NetBSD: cgsix.c,v 1.47 2010/05/04 05:11:06 macallan Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.46 2009/09/19 07:07:43 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.47 2010/05/04 05:11:06 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1345,6 +1345,7 @@
cgsix_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 cgsix_softc *sc = scr->scr_cookie;
int inv;
@@ -1359,10 +1360,10 @@
int x, y, wi, he;
volatile struct cg6_fbc *fbc = sc->sc_fbc;
- 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;
inv = ((attr >> 8) & WSATTR_REVERSE);
if (inv) {
@@ -1383,15 +1384,15 @@
if (c == 0x20) {
cgsix_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;
cgsix_setup_mono(sc, x, y, wi, 1, fg, bg);
for (i = 0; i < he; i++) {
- cgsix_feed_line(sc, ri->ri_font->stride,
+ cgsix_feed_line(sc, font->stride,
data);
- data += ri->ri_font->stride;
+ data += font->stride;
}
/* put the chip back to normal */
fbc->fbc_incy = 0;
Home |
Main Index |
Thread Index |
Old Index