Module Name: src Committed By: macallan Date: Tue May 4 04:57:35 UTC 2010
Modified Files: src/sys/dev/rasops: rasops.c rasops.h rasops1.c rasops15.c rasops2.c rasops24.c rasops32.c rasops4.c rasops8.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/dev/rasops/rasops.c cvs rdiff -u -r1.24 -r1.25 src/sys/dev/rasops/rasops.h cvs rdiff -u -r1.22 -r1.23 src/sys/dev/rasops/rasops1.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/rasops/rasops15.c \ src/sys/dev/rasops/rasops32.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/rasops/rasops2.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/rasops/rasops24.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/rasops/rasops4.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/rasops/rasops8.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/dev/rasops/rasops.c diff -u src/sys/dev/rasops/rasops.c:1.62 src/sys/dev/rasops/rasops.c:1.63 --- src/sys/dev/rasops/rasops.c:1.62 Sat Apr 17 13:36:22 2010 +++ src/sys/dev/rasops/rasops.c Tue May 4 04:57:34 2010 @@ -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 @@ #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 @@ }; #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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } 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 @@ } 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 @@ 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; + } + } +} Index: src/sys/dev/rasops/rasops.h diff -u src/sys/dev/rasops/rasops.h:1.24 src/sys/dev/rasops/rasops.h:1.25 --- src/sys/dev/rasops/rasops.h:1.24 Sat Apr 17 13:36:22 2010 +++ src/sys/dev/rasops/rasops.h Tue May 4 04:57:34 2010 @@ -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 @@ * 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 @@ * 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 @@ ((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(). * Index: src/sys/dev/rasops/rasops1.c diff -u src/sys/dev/rasops/rasops1.c:1.22 src/sys/dev/rasops/rasops1.c:1.23 --- src/sys/dev/rasops/rasops1.c:1.22 Tue Apr 13 20:10:38 2010 +++ src/sys/dev/rasops/rasops1.c Tue May 4 04:57:34 2010 @@ -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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } } } 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 @@ 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 @@ 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 @@ } } } 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 @@ } /* 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 */ Index: src/sys/dev/rasops/rasops15.c diff -u src/sys/dev/rasops/rasops15.c:1.18 src/sys/dev/rasops/rasops15.c:1.19 --- src/sys/dev/rasops/rasops15.c:1.18 Sat Mar 14 21:04:22 2009 +++ src/sys/dev/rasops/rasops15.c Tue May 4 04:57:34 2010 @@ -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 @@ 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 @@ 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 @@ } } } 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 @@ 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 @@ return; } - ri = (struct rasops_info *)cookie; hrp = NULL; #ifdef RASOPS_CLIPPING @@ -273,7 +273,7 @@ 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 @@ } } } 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 @@ 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 @@ return; } - ri = (struct rasops_info *)cookie; hrp = NULL; #ifdef RASOPS_CLIPPING @@ -370,7 +370,7 @@ 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 @@ } } } 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 @@ 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 @@ return; } - ri = (struct rasops_info *)cookie; hrp = NULL; #ifdef RASOPS_CLIPPING @@ -476,7 +476,7 @@ 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 @@ } } } 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; Index: src/sys/dev/rasops/rasops32.c diff -u src/sys/dev/rasops/rasops32.c:1.18 src/sys/dev/rasops/rasops32.c:1.19 --- src/sys/dev/rasops/rasops32.c:1.18 Sat Mar 14 21:04:22 2009 +++ src/sys/dev/rasops/rasops32.c Tue May 4 04:57:34 2010 @@ -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 @@ 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 @@ #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 @@ 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 @@ } } } 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; Index: src/sys/dev/rasops/rasops2.c diff -u src/sys/dev/rasops/rasops2.c:1.14 src/sys/dev/rasops/rasops2.c:1.15 --- src/sys/dev/rasops/rasops2.c:1.14 Sat Mar 14 21:04:22 2009 +++ src/sys/dev/rasops/rasops2.c Tue May 4 04:57:34 2010 @@ -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 @@ { 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 @@ 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 @@ 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 @@ 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 @@ #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 @@ 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 @@ 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 @@ #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 @@ 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 @@ 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 @@ #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 @@ 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]; Index: src/sys/dev/rasops/rasops24.c diff -u src/sys/dev/rasops/rasops24.c:1.27 src/sys/dev/rasops/rasops24.c:1.28 --- src/sys/dev/rasops/rasops24.c:1.27 Sat Mar 14 21:04:22 2009 +++ src/sys/dev/rasops/rasops24.c Tue May 4 04:57:34 2010 @@ -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 @@ 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 @@ #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 @@ } } } 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 @@ 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 @@ return; } - ri = (struct rasops_info *)cookie; - #ifdef RASOPS_CLIPPING if ((unsigned)row >= (unsigned)ri->ri_rows) { stamp_mutex--; @@ -271,7 +269,7 @@ 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 @@ 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 @@ 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 @@ return; } - ri = (struct rasops_info *)cookie; - #ifdef RASOPS_CLIPPING if ((unsigned)row >= (unsigned)ri->ri_rows) { stamp_mutex--; @@ -348,7 +345,7 @@ 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 @@ 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 @@ 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 @@ return; } - ri = (struct rasops_info *)cookie; - #ifdef RASOPS_CLIPPING if ((unsigned)row >= (unsigned)ri->ri_rows) { stamp_mutex--; @@ -432,7 +428,7 @@ 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 @@ 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; Index: src/sys/dev/rasops/rasops4.c diff -u src/sys/dev/rasops/rasops4.c:1.9 src/sys/dev/rasops/rasops4.c:1.10 --- src/sys/dev/rasops/rasops4.c:1.9 Sat Mar 14 21:04:22 2009 +++ src/sys/dev/rasops/rasops4.c Tue May 4 04:57:34 2010 @@ -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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ #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 @@ 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 @@ 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 @@ 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 @@ #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 @@ 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 @@ 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 @@ 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 @@ #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 @@ 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]; Index: src/sys/dev/rasops/rasops8.c diff -u src/sys/dev/rasops/rasops8.c:1.26 src/sys/dev/rasops/rasops8.c:1.27 --- src/sys/dev/rasops/rasops8.c:1.26 Sat Mar 14 21:04:22 2009 +++ src/sys/dev/rasops/rasops8.c Tue May 4 04:57:34 2010 @@ -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 @@ { 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 @@ 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 @@ } } } 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 @@ 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 @@ 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 @@ 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 @@ } } } 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 @@ 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 @@ 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 @@ 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 @@ } } } 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 @@ 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 @@ 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 @@ 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 @@ } } } 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);