autogenerate box drawing characters for fonts that don't have them, put them

into an alternate font pointed at by the recently added mappings in wsfont,
adapt all putchar() methods except the rotated ones to use them
XXX no attempt has been made to make this work with rotation
This commit is contained in:
macallan 2010-05-04 04:57:34 +00:00
parent 9bdc7d44b6
commit 15a269471f
9 changed files with 365 additions and 208 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops.c,v 1.62 2010/04/17 13:36:22 nonaka Exp $ */
/* $NetBSD: rasops.c,v 1.63 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.62 2010/04/17 13:36:22 nonaka Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.63 2010/05/04 04:57:34 macallan Exp $");
#include "opt_rasops.h"
#include "rasops_glue.h"
@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.62 2010/04/17 13:36:22 nonaka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/kmem.h>
#include <sys/bswap.h>
#include <machine/endian.h>
@ -158,6 +159,10 @@ struct rotatedfont {
};
#endif /* NRASOPS_ROTATION > 0 */
void rasops_make_box_chars_8(struct rasops_info *);
void rasops_make_box_chars_16(struct rasops_info *);
void rasops_make_box_chars_32(struct rasops_info *);
/*
* Initialize a 'rasops_info' descriptor.
*/
@ -165,6 +170,7 @@ int
rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
{
memset (&ri->ri_optfont, 0, sizeof(ri->ri_optfont));
#ifdef _KERNEL
/* Select a font if the caller doesn't care */
if (ri->ri_font == NULL) {
@ -232,10 +238,40 @@ rasops_init(struct rasops_info *ri, int wantrows, int wantcols)
int
rasops_reconfig(struct rasops_info *ri, int wantrows, int wantcols)
{
int bpp, s;
int bpp, s, len;
s = splhigh();
/* throw away old line drawing character bitmaps, if we have any */
if (ri->ri_optfont.data != NULL) {
kmem_free(ri->ri_optfont.data, ri->ri_optfont.stride *
ri->ri_optfont.fontheight * ri->ri_optfont.numchars);
ri->ri_optfont.data = NULL;
}
/* autogenerate box drawing characters */
ri->ri_optfont.fontwidth = ri->ri_font->fontwidth;
ri->ri_optfont.fontheight = ri->ri_font->fontheight;
ri->ri_optfont.stride = ri->ri_font->stride;
ri->ri_optfont.firstchar = WSFONT_FLAG_OPT;
ri->ri_optfont.numchars = 16;
len = ri->ri_optfont.fontheight * ri->ri_optfont.stride *
ri->ri_optfont.numchars;
if ((ri->ri_optfont.data = kmem_zalloc(len, KM_SLEEP)) != NULL) {
switch (ri->ri_optfont.stride) {
case 1:
rasops_make_box_chars_8(ri);
break;
case 2:
rasops_make_box_chars_16(ri);
break;
case 4:
rasops_make_box_chars_32(ri);
break;
}
}
if (ri->ri_font->fontwidth > 32 || ri->ri_font->fontwidth < 4)
panic("rasops_init: fontwidth assumptions botched!");
@ -421,12 +457,9 @@ rasops_mapchar(void *cookie, int c, u_int *cp)
panic("rasops_mapchar: no font selected");
#endif
if (ri->ri_font->encoding != WSDISPLAY_FONTENC_ISO) {
if ( (c = wsfont_map_unichar(ri->ri_font, c)) < 0) {
*cp = ' ';
return (0);
}
if ( (c = wsfont_map_unichar(ri->ri_font, c)) < 0) {
*cp = ' ';
return (0);
}
if (c < ri->ri_font->firstchar) {
@ -434,11 +467,12 @@ rasops_mapchar(void *cookie, int c, u_int *cp)
return (0);
}
#if 0
if (c - ri->ri_font->firstchar >= ri->ri_font->numchars) {
*cp = ' ';
return (0);
}
#endif
*cp = c;
return (5);
}
@ -904,7 +938,7 @@ static void
rasops_do_cursor(struct rasops_info *ri)
{
int full1, height, cnt, slop1, slop2, row, col;
u_char *dp, *rp, *hrp, *hp;
u_char *dp, *rp, *hrp, *hp, tmp = 0;
hrp = hp = NULL;
@ -943,6 +977,7 @@ rasops_do_cursor(struct rasops_info *ri)
full1 = (ri->ri_xscale - slop1 - slop2) >> 2;
if ((slop1 | slop2) == 0) {
uint32_t tmp32;
/* A common case */
while (height--) {
dp = rp;
@ -953,17 +988,18 @@ rasops_do_cursor(struct rasops_info *ri)
}
for (cnt = full1; cnt; cnt--) {
*(int32_t *)dp ^= ~0;
tmp32 = *(int32_t *)dp ^ ~0;
*(int32_t *)dp = tmp32;
dp += 4;
if (ri->ri_hwbits) {
dp -= 4;
*(int32_t *)hp = *(int32_t *)dp;
*(int32_t *)hp = tmp32;
hp += 4;
dp += 4;
}
}
}
} else {
uint16_t tmp16;
uint32_t tmp32;
/* XXX this is stupid.. use masks instead */
while (height--) {
dp = rp;
@ -974,44 +1010,47 @@ rasops_do_cursor(struct rasops_info *ri)
}
if (slop1 & 1) {
*dp++ ^= ~0;
tmp = *dp ^ ~0;
*dp = tmp;
dp++;
if (ri->ri_hwbits) {
*hp++ = *(dp - 1);
*hp++ = tmp;
}
}
if (slop1 & 2) {
*(int16_t *)dp ^= ~0;
tmp16 = *(int16_t *)dp ^ ~0;
*(uint16_t *)dp = tmp16;
dp += 2;
if (ri->ri_hwbits) {
dp -= 2;
*(int16_t *)hp = *(int16_t *)dp;
*(int16_t *)hp = tmp16;
hp += 2;
dp += 2;
}
}
for (cnt = full1; cnt; cnt--) {
*(int32_t *)dp ^= ~0;
tmp32 = *(int32_t *)dp ^ ~0;
*(uint32_t *)dp = tmp32;
dp += 4;
if (ri->ri_hwbits) {
dp -= 4;
*(int32_t *)hp = *(int32_t *)dp;
*(int32_t *)hp = tmp32;
hp += 4;
dp += 4;
}
}
if (slop2 & 1) {
*dp++ ^= ~0;
tmp = *dp ^ ~0;
*dp = tmp;
dp++;
if (ri->ri_hwbits)
*hp++ = *(dp - 1);
*hp++ = tmp;
}
if (slop2 & 2) {
*(int16_t *)dp ^= ~0;
tmp16 = *(int16_t *)dp ^ ~0;
*(uint16_t *)dp = tmp16;
if (ri->ri_hwbits)
*(int16_t *)hp = *(int16_t *)(dp - 2);
*(int16_t *)hp = tmp16;
}
}
}
@ -1459,3 +1498,120 @@ rasops_copycols_rotated_ccw(void *cookie, int row, int src, int dst, int num)
src + coff, dst + coff);
}
#endif /* NRASOPS_ROTATION */
void
rasops_make_box_chars_16(struct rasops_info *ri)
{
uint16_t vert_mask, hmask_left, hmask_right;
uint16_t *data = (uint16_t *)ri->ri_optfont.data;
int c, i, mid;
vert_mask = 0xc000 >> ((ri->ri_font->fontwidth >> 1) - 1);
hmask_left = 0xff00 << (8 - (ri->ri_font->fontwidth >> 1));
hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
mid = (ri->ri_font->fontheight + 1) >> 1;
/* 0x00 would be empty anyway so don't bother */
for (c = 1; c < 16; c++) {
data += ri->ri_font->fontheight;
if (c & 1) {
/* upper segment */
for (i = 0; i < mid; i++)
data[i] = vert_mask;
}
if (c & 4) {
/* lower segment */
for (i = mid; i < ri->ri_font->fontheight; i++)
data[i] = vert_mask;
}
if (c & 2) {
/* right segment */
i = ri->ri_font->fontheight >> 1;
data[mid - 1] |= hmask_right;
data[mid] |= hmask_right;
}
if (c & 8) {
/* left segment */
data[mid - 1] |= hmask_left;
data[mid] |= hmask_left;
}
}
}
void
rasops_make_box_chars_8(struct rasops_info *ri)
{
uint8_t vert_mask, hmask_left, hmask_right;
uint8_t *data = (uint8_t *)ri->ri_optfont.data;
int c, i, mid;
vert_mask = 0xc0 >> ((ri->ri_font->fontwidth >> 1) - 1);
hmask_left = 0xf0 << (4 - (ri->ri_font->fontwidth >> 1));
hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
mid = (ri->ri_font->fontheight + 1) >> 1;
/* 0x00 would be empty anyway so don't bother */
for (c = 1; c < 16; c++) {
data += ri->ri_font->fontheight;
if (c & 1) {
/* upper segment */
for (i = 0; i < mid; i++)
data[i] = vert_mask;
}
if (c & 4) {
/* lower segment */
for (i = mid; i < ri->ri_font->fontheight; i++)
data[i] = vert_mask;
}
if (c & 2) {
/* right segment */
i = ri->ri_font->fontheight >> 1;
data[mid - 1] |= hmask_right;
data[mid] |= hmask_right;
}
if (c & 8) {
/* left segment */
data[mid - 1] |= hmask_left;
data[mid] |= hmask_left;
}
}
}
void
rasops_make_box_chars_32(struct rasops_info *ri)
{
uint32_t vert_mask, hmask_left, hmask_right;
uint32_t *data = (uint32_t *)ri->ri_optfont.data;
int c, i, mid;
vert_mask = 0xc0000000 >> ((ri->ri_font->fontwidth >> 1) - 1);
hmask_left = 0xffff0000 << (16 - (ri->ri_font->fontwidth >> 1));
hmask_right = hmask_left >> ((ri->ri_font->fontwidth + 1)>> 1);
mid = (ri->ri_font->fontheight + 1) >> 1;
/* 0x00 would be empty anyway so don't bother */
for (c = 1; c < 16; c++) {
data += ri->ri_font->fontheight;
if (c & 1) {
/* upper segment */
for (i = 0; i < mid; i++)
data[i] = vert_mask;
}
if (c & 4) {
/* lower segment */
for (i = mid; i < ri->ri_font->fontheight; i++)
data[i] = vert_mask;
}
if (c & 2) {
/* right segment */
i = ri->ri_font->fontheight >> 1;
data[mid - 1] |= hmask_right;
data[mid] |= hmask_right;
}
if (c & 8) {
/* left segment */
data[mid - 1] |= hmask_left;
data[mid] |= hmask_left;
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops.h,v 1.24 2010/04/17 13:36:22 nonaka Exp $ */
/* $NetBSD: rasops.h,v 1.25 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -32,7 +32,8 @@
#ifndef _RASOPS_H_
#define _RASOPS_H_ 1
struct wsdisplay_font;
#include <dev/wscons/wsconsio.h>
#include <dev/wsfont/wsfont.h>
/* For rasops_info::ri_flg */
#define RI_FULLCLEAR 0x01 /* eraserows() hack to clear full screen */
@ -67,6 +68,7 @@ struct rasops_info {
* but aren't using wsfont, set ri_wsfcookie to -1.
*/
struct wsdisplay_font *ri_font;
struct wsdisplay_font ri_optfont;
int ri_wsfcookie; /* wsfont cookie */
void *ri_hw; /* driver private data; ignored by rasops */
int ri_crow; /* cursor row */
@ -78,7 +80,8 @@ struct rasops_info {
* on depths other than 15, 16, 24 and 32 bits per pel. On
* 24 bit displays, ri_{r,g,b}num must be 8.
*/
u_char ri_rnum; /* number of bits for red */
u_char ri_rnum;
/* number of bits for red */
u_char ri_gnum; /* number of bits for green */
u_char ri_bnum; /* number of bits for blue */
u_char ri_rpos; /* which bit red starts at */
@ -121,6 +124,9 @@ struct rasops_info {
((c) >= (font)->firstchar && \
((c) - (font)->firstchar) < (font)->numchars)
#define PICK_FONT(ri, c) ((c & WSFONT_FLAGS_MASK) == WSFONT_FLAG_OPT) ? \
&ri->ri_optfont : ri->ri_font
/*
* rasops_init().
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops1.c,v 1.22 2010/04/13 20:10:38 macallan Exp $ */
/* $NetBSD: rasops1.c,v 1.23 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.22 2010/04/13 20:10:38 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.23 2010/05/04 04:57:34 macallan Exp $");
#include "opt_rasops.h"
@ -89,12 +89,11 @@ rasops1_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
u_int fs, rs, fb, bg, fg, lmask, rmask;
u_int32_t height, width;
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int32_t *rp, *hrp = NULL, tmp, tmp2;
u_char *fr;
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows)
@ -109,8 +108,8 @@ rasops1_putchar(void *cookie, int row, int col, u_int uc, long attr)
if (ri->ri_hwbits)
hrp = (int32_t *)(ri->ri_hwbits + row * ri->ri_yscale +
((col >> 3) & ~3));
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
height = font->fontheight;
width = font->fontwidth;
col = col & 31;
rs = ri->ri_stride;
@ -123,9 +122,9 @@ rasops1_putchar(void *cookie, int row, int col, u_int uc, long attr)
fr = 0; /* shutup gcc */
fs = 0; /* shutup gcc */
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
}
/* Single word, one mask */
@ -281,11 +280,10 @@ static void
rasops1_putchar8(void *cookie, int row, int col, u_int uc, long attr)
{
int height, fs, rs, bg, fg;
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
u_char *fr, *rp, *hrp = NULL;
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows)
@ -298,7 +296,7 @@ rasops1_putchar8(void *cookie, int row, int col, u_int uc, long attr)
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
if (ri->ri_hwbits)
hrp = ri->ri_hwbits + row * ri->ri_yscale + col * ri->ri_xscale;
height = ri->ri_font->fontheight;
height = font->fontheight;
rs = ri->ri_stride;
bg = (attr & 0x000f0000) ? ri->ri_devcmap[1] : ri->ri_devcmap[0];
@ -315,9 +313,9 @@ rasops1_putchar8(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
/* NOT fontbits if bg is white */
if (bg) {
@ -361,11 +359,10 @@ static void
rasops1_putchar16(void *cookie, int row, int col, u_int uc, long attr)
{
int height, fs, rs, bg, fg;
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
u_char *fr, *rp, *hrp = NULL;
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows)
@ -378,7 +375,7 @@ rasops1_putchar16(void *cookie, int row, int col, u_int uc, long attr)
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
if (ri->ri_hwbits)
hrp = ri->ri_hwbits + row * ri->ri_yscale + col * ri->ri_xscale;
height = ri->ri_font->fontheight;
height = font->fontheight;
rs = ri->ri_stride;
bg = (attr & 0x000f0000) ? ri->ri_devcmap[1] : ri->ri_devcmap[0];
@ -396,9 +393,9 @@ rasops1_putchar16(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
/* NOT fontbits if bg is white */
if (bg) {
@ -429,11 +426,13 @@ rasops1_putchar16(void *cookie, int row, int col, u_int uc, long attr)
}
/* Do underline */
if ((attr & 1) != 0)
if ((attr & 1) != 0) {
/* XXX alignment?! */
*(int16_t *)(rp - (ri->ri_stride << 1)) = fg;
if (ri->ri_hwbits)
if (ri->ri_hwbits) {
*(int16_t *)(hrp - (ri->ri_stride << 1)) = fg;
}
}
}
#endif /* !RASOPS_SMALL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops15.c,v 1.18 2009/03/14 21:04:22 dsl Exp $ */
/* $NetBSD: rasops15.c,v 1.19 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.18 2009/03/14 21:04:22 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.19 2010/05/04 04:57:34 macallan Exp $");
#include "opt_rasops.h"
@ -114,10 +114,10 @@ static void
rasops15_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
int fb, width, height, cnt, clr[2];
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
u_char *dp, *rp, *hp, *hrp, *fr;
ri = (struct rasops_info *)cookie;
hp = hrp = NULL;
#ifdef RASOPS_CLIPPING
@ -133,8 +133,8 @@ rasops15_putchar(void *cookie, int row, int col, u_int uc, long attr)
if (ri->ri_hwbits)
hrp = ri->ri_hwbits + row * ri->ri_yscale +
col * ri->ri_xscale;
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
height = font->fontheight;
width = font->fontwidth;
clr[1] = ri->ri_devcmap[((u_int)attr >> 24) & 0xf];
clr[0] = ri->ri_devcmap[((u_int)attr >> 16) & 0xf];
@ -159,13 +159,13 @@ rasops15_putchar(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
while (height--) {
dp = rp;
fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) | (fr[0] << 24);
fr += ri->ri_font->stride;
fr += font->stride;
rp += ri->ri_stride;
if (ri->ri_hwbits) {
hp = hrp;
@ -238,7 +238,8 @@ rasops15_makestamp(struct rasops_info *ri, long attr)
static void
rasops15_putchar8(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, so, fs;
int32_t *rp, *hrp;
u_char *fr;
@ -250,7 +251,6 @@ rasops15_putchar8(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
hrp = NULL;
#ifdef RASOPS_CLIPPING
@ -273,7 +273,7 @@ rasops15_putchar8(void *cookie, int row, int col, u_int uc, long attr)
if (ri->ri_hwbits)
hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == (u_int)-1) {
int32_t c = stamp[0];
@ -286,9 +286,9 @@ rasops15_putchar8(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc*ri->ri_fontscale;
fs = font->stride;
while (height--) {
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
@ -335,7 +335,8 @@ rasops15_putchar8(void *cookie, int row, int col, u_int uc, long attr)
static void
rasops15_putchar12(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, so, fs;
int32_t *rp, *hrp;
u_char *fr;
@ -347,7 +348,6 @@ rasops15_putchar12(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
hrp = NULL;
#ifdef RASOPS_CLIPPING
@ -370,7 +370,7 @@ rasops15_putchar12(void *cookie, int row, int col, u_int uc, long attr)
if (ri->ri_hwbits)
hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == (u_int)-1) {
int32_t c = stamp[0];
@ -384,9 +384,9 @@ rasops15_putchar12(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc*ri->ri_fontscale;
fs = font->stride;
while (height--) {
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
@ -441,7 +441,8 @@ rasops15_putchar12(void *cookie, int row, int col, u_int uc, long attr)
static void
rasops15_putchar16(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, so, fs;
int32_t *rp, *hrp;
u_char *fr;
@ -453,7 +454,6 @@ rasops15_putchar16(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
hrp = NULL;
#ifdef RASOPS_CLIPPING
@ -476,7 +476,7 @@ rasops15_putchar16(void *cookie, int row, int col, u_int uc, long attr)
if (ri->ri_hwbits)
hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == (u_int)-1) {
int32_t c = stamp[0];
@ -491,9 +491,9 @@ rasops15_putchar16(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc*ri->ri_fontscale;
fs = font->stride;
while (height--) {
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops2.c,v 1.14 2009/03/14 21:04:22 dsl Exp $ */
/* $NetBSD: rasops2.c,v 1.15 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.14 2009/03/14 21:04:22 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.15 2010/05/04 04:57:34 macallan Exp $");
#include "opt_rasops.h"
@ -103,6 +103,7 @@ rasops2_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
int height, width, fs, rs, fb, bg, fg, lmask, rmask;
struct rasops_info *ri;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int32_t *rp;
u_char *fr;
@ -117,8 +118,8 @@ rasops2_putchar(void *cookie, int row, int col, u_int uc, long attr)
return;
#endif
width = ri->ri_font->fontwidth << 1;
height = ri->ri_font->fontheight;
width = font->fontwidth << 1;
height = font->fontheight;
col *= width;
rp = (int32_t *)(ri->ri_bits + row * ri->ri_yscale + ((col >> 3) & ~3));
col = col & 31;
@ -133,9 +134,9 @@ rasops2_putchar(void *cookie, int row, int col, u_int uc, long attr)
fr = 0; /* shutup gcc */
fs = 0; /* shutup gcc */
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
}
/* Single word, one mask */
@ -244,6 +245,7 @@ static void
rasops2_putchar8(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs, rs;
u_char *fr, *rp;
@ -270,7 +272,7 @@ rasops2_putchar8(void *cookie, int row, int col, u_int uc, long attr)
#endif
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
height = ri->ri_font->fontheight;
height = font->fontheight;
rs = ri->ri_stride;
/* Recompute stamp? */
@ -284,9 +286,9 @@ rasops2_putchar8(void *cookie, int row, int col, u_int uc, long attr)
rp += rs;
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = stamp[(*fr >> 4) & 0xf];
@ -310,6 +312,7 @@ static void
rasops2_putchar12(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs, rs;
u_char *fr, *rp;
@ -336,7 +339,7 @@ rasops2_putchar12(void *cookie, int row, int col, u_int uc, long attr)
#endif
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
height = ri->ri_font->fontheight;
height = font->fontheight;
rs = ri->ri_stride;
/* Recompute stamp? */
@ -350,9 +353,9 @@ rasops2_putchar12(void *cookie, int row, int col, u_int uc, long attr)
rp += rs;
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = stamp[(fr[0] >> 4) & 0xf];
@ -379,6 +382,7 @@ static void
rasops2_putchar16(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs, rs;
u_char *fr, *rp;
@ -405,7 +409,7 @@ rasops2_putchar16(void *cookie, int row, int col, u_int uc, long attr)
#endif
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
height = ri->ri_font->fontheight;
height = font->fontheight;
rs = ri->ri_stride;
/* Recompute stamp? */
@ -419,9 +423,9 @@ rasops2_putchar16(void *cookie, int row, int col, u_int uc, long attr)
rp += rs;
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = stamp[(fr[0] >> 4) & 0xf];

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops24.c,v 1.27 2009/03/14 21:04:22 dsl Exp $ */
/* $NetBSD: rasops24.c,v 1.28 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.27 2009/03/14 21:04:22 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.28 2010/05/04 04:57:34 macallan Exp $");
#include "opt_rasops.h"
@ -120,11 +120,10 @@ static void
rasops24_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
int fb, width, height, cnt, clr[2];
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
u_char *dp, *rp, *fr;
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows)
@ -135,8 +134,8 @@ rasops24_putchar(void *cookie, int row, int col, u_int uc, long attr)
#endif
rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
height = font->fontheight;
width = font->fontwidth;
clr[1] = ri->ri_devcmap[((u_int)attr >> 24) & 0xf];
clr[0] = ri->ri_devcmap[((u_int)attr >> 16) & 0xf];
@ -154,14 +153,14 @@ rasops24_putchar(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
while (height--) {
dp = rp;
fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) |
(fr[0] << 24);
fr += ri->ri_font->stride;
fr += font->stride;
rp += ri->ri_stride;
for (cnt = width; cnt; cnt--, fb <<= 1) {
@ -240,7 +239,8 @@ rasops24_makestamp(struct rasops_info *ri, long attr)
static void
rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, so, fs;
int32_t *rp;
u_char *fr;
@ -252,8 +252,6 @@ rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
stamp_mutex--;
@ -271,7 +269,7 @@ rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
rasops24_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == (u_int)-1) {
int32_t c = stamp[0];
@ -280,9 +278,9 @@ rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
DELTA(rp, ri->ri_stride, int32_t *);
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc*ri->ri_fontscale;
fs = font->stride;
while (height--) {
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
@ -317,7 +315,8 @@ rasops24_putchar8(void *cookie, int row, int col, u_int uc, long attr)
static void
rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, so, fs;
int32_t *rp;
u_char *fr;
@ -329,8 +328,6 @@ rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
stamp_mutex--;
@ -348,7 +345,7 @@ rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
rasops24_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == (u_int)-1) {
int32_t c = stamp[0];
@ -358,9 +355,9 @@ rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
DELTA(rp, ri->ri_stride, int32_t *);
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc*ri->ri_fontscale;
fs = font->stride;
while (height--) {
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
@ -401,7 +398,8 @@ rasops24_putchar12(void *cookie, int row, int col, u_int uc, long attr)
static void
rasops24_putchar16(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, so, fs;
int32_t *rp;
u_char *fr;
@ -413,8 +411,6 @@ rasops24_putchar16(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
if ((unsigned)row >= (unsigned)ri->ri_rows) {
stamp_mutex--;
@ -432,7 +428,7 @@ rasops24_putchar16(void *cookie, int row, int col, u_int uc, long attr)
rasops24_makestamp(ri, attr);
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == (u_int)-1) {
int32_t c = stamp[0];
@ -443,9 +439,9 @@ rasops24_putchar16(void *cookie, int row, int col, u_int uc, long attr)
DELTA(rp, ri->ri_stride, int32_t *);
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc*ri->ri_fontscale;
fs = font->stride;
while (height--) {
so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops32.c,v 1.18 2009/03/14 21:04:22 dsl Exp $ */
/* $NetBSD: rasops32.c,v 1.19 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.18 2009/03/14 21:04:22 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.19 2010/05/04 04:57:34 macallan Exp $");
#include "opt_rasops.h"
@ -70,11 +70,11 @@ static void
rasops32_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
int width, height, cnt, fs, fb, clr[2];
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int32_t *dp, *rp, *hp, *hrp;
u_char *fr;
ri = (struct rasops_info *)cookie;
hp = hrp = NULL;
#ifdef RASOPS_CLIPPING
@ -87,8 +87,8 @@ rasops32_putchar(void *cookie, int row, int col, u_int uc, long attr)
#endif
/* check if character fits into font limits */
if (uc < ri->ri_font->firstchar ||
(uc - ri->ri_font->firstchar) >= ri->ri_font->numchars)
if (uc < font->firstchar ||
(uc - font->firstchar) >= font->numchars)
return;
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
@ -96,8 +96,8 @@ rasops32_putchar(void *cookie, int row, int col, u_int uc, long attr)
hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
col*ri->ri_xscale);
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
height = font->fontheight;
width = font->fontwidth;
clr[0] = ri->ri_devcmap[(attr >> 16) & 0xf];
clr[1] = ri->ri_devcmap[(attr >> 24) & 0xf];
@ -118,9 +118,9 @@ rasops32_putchar(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
dp = rp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops4.c,v 1.9 2009/03/14 21:04:22 dsl Exp $ */
/* $NetBSD: rasops4.c,v 1.10 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.9 2009/03/14 21:04:22 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.10 2010/05/04 04:57:34 macallan Exp $");
#include "opt_rasops.h"
@ -102,12 +102,11 @@ static void
rasops4_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
int height, width, fs, rs, fb, bg, fg, lmask, rmask;
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int32_t *rp;
u_char *fr;
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows)
@ -117,8 +116,8 @@ rasops4_putchar(void *cookie, int row, int col, u_int uc, long attr)
return;
#endif
width = ri->ri_font->fontwidth << 1;
height = ri->ri_font->fontheight;
width = font->fontwidth << 1;
height = font->fontheight;
col *= width;
rp = (int32_t *)(ri->ri_bits + row * ri->ri_yscale + ((col >> 3) & ~3));
col = col & 31;
@ -133,9 +132,9 @@ rasops4_putchar(void *cookie, int row, int col, u_int uc, long attr)
fr = 0; /* shutup gcc */
fs = 0; /* shutup gcc */
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
}
/* Single word, one mask */
@ -243,7 +242,8 @@ rasops4_makestamp(struct rasops_info *ri, long attr)
static void
rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs, rs;
u_char *fr;
u_int16_t *rp;
@ -255,8 +255,6 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows) {
@ -271,7 +269,7 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
#endif
rp = (u_int16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
rs = ri->ri_stride / sizeof(*rp);
/* Recompute stamp? */
@ -286,9 +284,9 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
rp += rs;
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = stamp[(*fr >> 4) & 0xf];
@ -314,7 +312,8 @@ rasops4_putchar8(void *cookie, int row, int col, u_int uc, long attr)
static void
rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs, rs;
u_char *fr;
u_int16_t *rp;
@ -326,8 +325,6 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows) {
@ -342,7 +339,7 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
#endif
rp = (u_int16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
rs = ri->ri_stride / sizeof(*rp);
/* Recompute stamp? */
@ -358,9 +355,9 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
rp += rs;
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = stamp[(fr[0] >> 4) & 0xf];
@ -388,7 +385,8 @@ rasops4_putchar12(void *cookie, int row, int col, u_int uc, long attr)
static void
rasops4_putchar16(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs, rs;
u_char *fr;
u_int16_t *rp;
@ -400,8 +398,6 @@ rasops4_putchar16(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
#ifdef RASOPS_CLIPPING
/* Catches 'row < 0' case too */
if ((unsigned)row >= (unsigned)ri->ri_rows) {
@ -416,7 +412,7 @@ rasops4_putchar16(void *cookie, int row, int col, u_int uc, long attr)
#endif
rp = (u_int16_t *)(ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
rs = ri->ri_stride / sizeof(*rp);
/* Recompute stamp? */
@ -433,9 +429,9 @@ rasops4_putchar16(void *cookie, int row, int col, u_int uc, long attr)
rp += rs;
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = stamp[(fr[0] >> 4) & 0xf];

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops8.c,v 1.26 2009/03/14 21:04:22 dsl Exp $ */
/* $NetBSD: rasops8.c,v 1.27 2010/05/04 04:57:34 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.26 2009/03/14 21:04:22 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.27 2010/05/04 04:57:34 macallan Exp $");
#include "opt_rasops.h"
@ -101,12 +101,12 @@ rasops8_putchar(void *cookie, int row, int col, u_int uc, long attr)
{
int width, height, cnt, fs, fb;
u_char *dp, *rp, *hp, *hrp, *fr, clr[2];
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
ri = (struct rasops_info *)cookie;
hp = hrp = NULL;
if (!CHAR_IN_FONT(uc, ri->ri_font))
if (!CHAR_IN_FONT(uc, font))
return;
#ifdef RASOPS_CLIPPING
@ -122,8 +122,8 @@ rasops8_putchar(void *cookie, int row, int col, u_int uc, long attr)
hrp = ri->ri_hwbits + row * ri->ri_yscale + col *
ri->ri_xscale;
height = ri->ri_font->fontheight;
width = ri->ri_font->fontwidth;
height = font->fontheight;
width = font->fontwidth;
clr[0] = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
clr[1] = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
@ -145,9 +145,9 @@ rasops8_putchar(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
dp = rp;
@ -226,7 +226,8 @@ rasops8_makestamp(struct rasops_info *ri, long attr)
static void
rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs;
int32_t *rp, *hp;
u_char *fr;
@ -238,10 +239,9 @@ rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
hp = NULL;
if (!CHAR_IN_FONT(uc, ri->ri_font))
if (!CHAR_IN_FONT(uc, font))
return;
#ifdef RASOPS_CLIPPING
@ -264,7 +264,7 @@ rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
if (ri->ri_hwbits)
hp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == ' ') {
while (height--) {
@ -277,9 +277,9 @@ rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
@ -318,7 +318,8 @@ rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
static void
rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs;
int32_t *rp, *hrp;
u_char *fr;
@ -330,10 +331,9 @@ rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
hrp = NULL;
if (!CHAR_IN_FONT(uc, ri->ri_font))
if (!CHAR_IN_FONT(uc, font))
return;
#ifdef RASOPS_CLIPPING
@ -356,7 +356,7 @@ rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
if (ri->ri_hwbits)
hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == ' ') {
while (height--) {
@ -372,9 +372,9 @@ rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
@ -414,7 +414,8 @@ rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
static void
rasops8_putchar16(void *cookie, int row, int col, u_int uc, long attr)
{
struct rasops_info *ri;
struct rasops_info *ri = (struct rasops_info *)cookie;
struct wsdisplay_font *font = PICK_FONT(ri, uc);
int height, fs;
int32_t *rp, *hrp;
u_char *fr;
@ -426,10 +427,9 @@ rasops8_putchar16(void *cookie, int row, int col, u_int uc, long attr)
return;
}
ri = (struct rasops_info *)cookie;
hrp = NULL;
if (!CHAR_IN_FONT(uc, ri->ri_font))
if (!CHAR_IN_FONT(uc, font))
return;
#ifdef RASOPS_CLIPPING
@ -453,7 +453,7 @@ rasops8_putchar16(void *cookie, int row, int col, u_int uc, long attr)
hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
col*ri->ri_xscale);
height = ri->ri_font->fontheight;
height = font->fontheight;
if (uc == ' ') {
while (height--) {
@ -466,9 +466,9 @@ rasops8_putchar16(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= ri->ri_font->firstchar;
fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
fs = ri->ri_font->stride;
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fs = font->stride;
while (height--) {
rp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);