Home | History | Annotate | Line # | Download | only in rasops
rasops2.c revision 1.8
      1  1.8  lukem /* 	$NetBSD: rasops2.c,v 1.8 2001/11/13 07:00:23 lukem Exp $	*/
      2  1.1     ad 
      3  1.2     ad /*-
      4  1.2     ad  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  1.1     ad  * All rights reserved.
      6  1.1     ad  *
      7  1.2     ad  * This code is derived from software contributed to The NetBSD Foundation
      8  1.6     ad  * by Andrew Doran.
      9  1.2     ad  *
     10  1.1     ad  * Redistribution and use in source and binary forms, with or without
     11  1.1     ad  * modification, are permitted provided that the following conditions
     12  1.1     ad  * are met:
     13  1.1     ad  * 1. Redistributions of source code must retain the above copyright
     14  1.1     ad  *    notice, this list of conditions and the following disclaimer.
     15  1.1     ad  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1     ad  *    notice, this list of conditions and the following disclaimer in the
     17  1.1     ad  *    documentation and/or other materials provided with the distribution.
     18  1.2     ad  * 3. All advertising materials mentioning features or use of this software
     19  1.2     ad  *    must display the following acknowledgement:
     20  1.2     ad  *	This product includes software developed by the NetBSD
     21  1.2     ad  *	Foundation, Inc. and its contributors.
     22  1.2     ad  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.2     ad  *    contributors may be used to endorse or promote products derived
     24  1.2     ad  *    from this software without specific prior written permission.
     25  1.1     ad  *
     26  1.2     ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.2     ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.2     ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.2     ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.2     ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.2     ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.2     ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.2     ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.2     ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.2     ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.2     ad  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1     ad  */
     38  1.1     ad 
     39  1.8  lukem #include <sys/cdefs.h>
     40  1.8  lukem __KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.8 2001/11/13 07:00:23 lukem Exp $");
     41  1.8  lukem 
     42  1.1     ad #include "opt_rasops.h"
     43  1.1     ad 
     44  1.1     ad #include <sys/types.h>
     45  1.1     ad #include <sys/param.h>
     46  1.1     ad #include <sys/systm.h>
     47  1.1     ad #include <sys/time.h>
     48  1.1     ad #include <machine/endian.h>
     49  1.1     ad 
     50  1.1     ad #include <dev/wscons/wsdisplayvar.h>
     51  1.1     ad #include <dev/wscons/wsconsio.h>
     52  1.1     ad #include <dev/rasops/rasops.h>
     53  1.1     ad #include <dev/rasops/rasops_masks.h>
     54  1.1     ad 
     55  1.4     ad static void	rasops2_copycols __P((void *, int, int, int, int));
     56  1.4     ad static void	rasops2_erasecols __P((void *, int, int, int, long));
     57  1.4     ad static void	rasops2_do_cursor __P((struct rasops_info *));
     58  1.1     ad static void	rasops2_putchar __P((void *, int, int col, u_int, long));
     59  1.4     ad #ifndef RASOPS_SMALL
     60  1.1     ad static void	rasops2_putchar8 __P((void *, int, int col, u_int, long));
     61  1.1     ad static void	rasops2_putchar12 __P((void *, int, int col, u_int, long));
     62  1.1     ad static void	rasops2_putchar16 __P((void *, int, int col, u_int, long));
     63  1.1     ad static void	rasops2_makestamp __P((struct rasops_info *, long));
     64  1.1     ad 
     65  1.5     pk /*
     66  1.5     pk  * 4x1 stamp for optimized character blitting
     67  1.1     ad  */
     68  1.1     ad static int8_t	stamp[16];
     69  1.1     ad static long	stamp_attr;
     70  1.1     ad static int	stamp_mutex;	/* XXX see note in README */
     71  1.7  bjh21 #endif
     72  1.1     ad 
     73  1.1     ad /*
     74  1.1     ad  * Initialize rasops_info struct for this colordepth.
     75  1.1     ad  */
     76  1.1     ad void
     77  1.1     ad rasops2_init(ri)
     78  1.1     ad 	struct rasops_info *ri;
     79  1.1     ad {
     80  1.1     ad 
     81  1.1     ad 	switch (ri->ri_font->fontwidth) {
     82  1.4     ad #ifndef RASOPS_SMALL
     83  1.1     ad 	case 8:
     84  1.1     ad 		ri->ri_ops.putchar = rasops2_putchar8;
     85  1.1     ad 		break;
     86  1.1     ad 	case 12:
     87  1.1     ad 		ri->ri_ops.putchar = rasops2_putchar12;
     88  1.1     ad 		break;
     89  1.1     ad 	case 16:
     90  1.1     ad 		ri->ri_ops.putchar = rasops2_putchar16;
     91  1.1     ad 		break;
     92  1.4     ad #endif	/* !RASOPS_SMALL */
     93  1.1     ad 	default:
     94  1.4     ad 		panic("fontwidth not 8/12/16 or RASOPS_SMALL - fixme!");
     95  1.1     ad 		ri->ri_ops.putchar = rasops2_putchar;
     96  1.1     ad 		break;
     97  1.1     ad 	}
     98  1.5     pk 
     99  1.3     ad 	if ((ri->ri_font->fontwidth & 3) != 0) {
    100  1.1     ad 		ri->ri_ops.erasecols = rasops2_erasecols;
    101  1.1     ad 		ri->ri_ops.copycols = rasops2_copycols;
    102  1.1     ad 		ri->ri_do_cursor = rasops2_do_cursor;
    103  1.1     ad 	}
    104  1.1     ad }
    105  1.1     ad 
    106  1.4     ad #ifdef notyet
    107  1.1     ad /*
    108  1.1     ad  * Paint a single character. This is the generic version, this is ugly.
    109  1.1     ad  */
    110  1.1     ad static void
    111  1.1     ad rasops2_putchar(cookie, row, col, uc, attr)
    112  1.1     ad 	void *cookie;
    113  1.1     ad 	int row, col;
    114  1.1     ad 	u_int uc;
    115  1.1     ad 	long attr;
    116  1.1     ad {
    117  1.1     ad 	int height, width, fs, rs, fb, bg, fg, lmask, rmask;
    118  1.1     ad 	struct rasops_info *ri;
    119  1.1     ad 	int32_t *rp;
    120  1.1     ad 	u_char *fr;
    121  1.5     pk 
    122  1.1     ad 	ri = (struct rasops_info *)cookie;
    123  1.1     ad 
    124  1.5     pk #ifdef RASOPS_CLIPPING
    125  1.5     pk 	/* Catches 'row < 0' case too */
    126  1.1     ad 	if ((unsigned)row >= (unsigned)ri->ri_rows)
    127  1.1     ad 		return;
    128  1.1     ad 
    129  1.1     ad 	if ((unsigned)col >= (unsigned)ri->ri_cols)
    130  1.1     ad 		return;
    131  1.1     ad #endif
    132  1.1     ad 
    133  1.1     ad 	width = ri->ri_font->fontwidth << 1;
    134  1.1     ad 	height = ri->ri_font->fontheight;
    135  1.1     ad 	col *= width;
    136  1.1     ad 	rp = (int32_t *)(ri->ri_bits + row * ri->ri_yscale + ((col >> 3) & ~3));
    137  1.1     ad 	col = col & 31;
    138  1.1     ad 	rs = ri->ri_stride;
    139  1.5     pk 
    140  1.5     pk 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
    141  1.5     pk 	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
    142  1.1     ad 
    143  1.1     ad 	/* If fg and bg match this becomes a space character */
    144  1.1     ad 	if (fg == bg || uc == ' ') {
    145  1.1     ad 		uc = (u_int)-1;
    146  1.1     ad 		fr = 0;		/* shutup gcc */
    147  1.1     ad 		fs = 0;		/* shutup gcc */
    148  1.1     ad 	} else {
    149  1.1     ad 		uc -= ri->ri_font->firstchar;
    150  1.1     ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    151  1.1     ad 		fs = ri->ri_font->stride;
    152  1.1     ad 	}
    153  1.5     pk 
    154  1.1     ad 	/* Single word, one mask */
    155  1.1     ad 	if ((col + width) <= 32) {
    156  1.1     ad 		rmask = rasops_pmask[col][width];
    157  1.1     ad 		lmask = ~rmask;
    158  1.5     pk 
    159  1.1     ad 		if (uc == (u_int)-1) {
    160  1.1     ad 			bg &= rmask;
    161  1.5     pk 
    162  1.1     ad 			while (height--) {
    163  1.1     ad 				*rp = (*rp & lmask) | bg;
    164  1.1     ad 				DELTA(rp, rs, int32_t *);
    165  1.1     ad 			}
    166  1.1     ad 		} else {
    167  1.1     ad 			while (height--) {
    168  1.1     ad 				/* get bits, mask */
    169  1.1     ad 				/* compose sl */
    170  1.1     ad 				/* mask sl */
    171  1.1     ad 				/* put word */
    172  1.1     ad 			}
    173  1.1     ad 		}
    174  1.5     pk 
    175  1.1     ad 		/* Do underline */
    176  1.1     ad 		if (attr & 1) {
    177  1.1     ad 			DELTA(rp, -(ri->ri_stride << 1), int32_t *);
    178  1.1     ad 			*rp = (*rp & lmask) | (fg & rmask);
    179  1.1     ad 		}
    180  1.1     ad 	} else {
    181  1.1     ad 		lmask = ~rasops_lmask[col];
    182  1.1     ad 		rmask = ~rasops_rmask[(col + width) & 31];
    183  1.5     pk 
    184  1.1     ad 		if (uc == (u_int)-1) {
    185  1.1     ad 			bg = bg & ~lmask;
    186  1.1     ad 			width = bg & ~rmask;
    187  1.5     pk 
    188  1.1     ad 			while (height--) {
    189  1.1     ad 				rp[0] = (rp[0] & lmask) | bg;
    190  1.1     ad 				rp[1] = (rp[1] & rmask) | width;
    191  1.1     ad 				DELTA(rp, rs, int32_t *);
    192  1.1     ad 			}
    193  1.1     ad 		} else {
    194  1.1     ad 			width = 32 - col;
    195  1.5     pk 
    196  1.1     ad 			/* NOT fontbits if bg is white */
    197  1.1     ad 			while (height--) {
    198  1.5     pk 				fb = ~(fr[3] | (fr[2] << 8) |
    199  1.1     ad 				    (fr[1] << 16) | (fr[0] << 24));
    200  1.5     pk 
    201  1.1     ad 				rp[0] = (rp[0] & lmask)
    202  1.1     ad 				    | MBE((u_int)fb >> col);
    203  1.1     ad 
    204  1.1     ad 				rp[1] = (rp[1] & rmask)
    205  1.1     ad 				   | (MBE((u_int)fb << width) & ~rmask);
    206  1.1     ad 
    207  1.1     ad 				fr += fs;
    208  1.1     ad 				DELTA(rp, rs, int32_t *);
    209  1.1     ad 			}
    210  1.1     ad 		}
    211  1.1     ad 
    212  1.1     ad 		/* Do underline */
    213  1.1     ad 		if (attr & 1) {
    214  1.1     ad 			DELTA(rp, -(ri->ri_stride << 1), int32_t *);
    215  1.1     ad 			rp[0] = (rp[0] & lmask) | (fg & ~lmask);
    216  1.1     ad 			rp[1] = (rp[1] & rmask) | (fg & ~rmask);
    217  1.1     ad 		}
    218  1.1     ad 	}
    219  1.1     ad }
    220  1.1     ad #endif
    221  1.1     ad 
    222  1.1     ad /*
    223  1.1     ad  * Put a single character. This is the generic version.
    224  1.1     ad  */
    225  1.1     ad static void
    226  1.1     ad rasops2_putchar(cookie, row, col, uc, attr)
    227  1.1     ad 	void *cookie;
    228  1.1     ad 	int row, col;
    229  1.1     ad 	u_int uc;
    230  1.1     ad 	long attr;
    231  1.1     ad {
    232  1.1     ad 
    233  1.1     ad 	/* XXX punt */
    234  1.1     ad }
    235  1.1     ad 
    236  1.4     ad #ifndef RASOPS_SMALL
    237  1.4     ad /*
    238  1.4     ad  * Recompute the blitting stamp.
    239  1.4     ad  */
    240  1.4     ad static void
    241  1.4     ad rasops2_makestamp(ri, attr)
    242  1.4     ad 	struct rasops_info *ri;
    243  1.4     ad 	long attr;
    244  1.4     ad {
    245  1.4     ad 	int i, fg, bg;
    246  1.5     pk 
    247  1.5     pk 	fg = ri->ri_devcmap[(attr >> 24) & 0xf] & 3;
    248  1.5     pk 	bg = ri->ri_devcmap[(attr >> 16) & 0xf] & 3;
    249  1.4     ad 	stamp_attr = attr;
    250  1.5     pk 
    251  1.4     ad 	for (i = 0; i < 16; i++) {
    252  1.4     ad 		stamp[i] = (i & 1 ? fg : bg);
    253  1.4     ad 		stamp[i] |= (i & 2 ? fg : bg) << 2;
    254  1.4     ad 		stamp[i] |= (i & 4 ? fg : bg) << 4;
    255  1.4     ad 		stamp[i] |= (i & 8 ? fg : bg) << 6;
    256  1.4     ad 	}
    257  1.4     ad }
    258  1.1     ad 
    259  1.1     ad /*
    260  1.1     ad  * Put a single character. This is for 8-pixel wide fonts.
    261  1.1     ad  */
    262  1.1     ad static void
    263  1.1     ad rasops2_putchar8(cookie, row, col, uc, attr)
    264  1.1     ad 	void *cookie;
    265  1.1     ad 	int row, col;
    266  1.1     ad 	u_int uc;
    267  1.1     ad 	long attr;
    268  1.1     ad {
    269  1.1     ad 	struct rasops_info *ri;
    270  1.1     ad 	int height, fs, rs;
    271  1.1     ad 	u_char *fr, *rp;
    272  1.5     pk 
    273  1.1     ad 	/* Can't risk remaking the stamp if it's already in use */
    274  1.1     ad 	if (stamp_mutex++) {
    275  1.1     ad 		stamp_mutex--;
    276  1.1     ad 		rasops2_putchar(cookie, row, col, uc, attr);
    277  1.1     ad 		return;
    278  1.1     ad 	}
    279  1.1     ad 
    280  1.1     ad 	ri = (struct rasops_info *)cookie;
    281  1.1     ad 
    282  1.5     pk #ifdef RASOPS_CLIPPING
    283  1.5     pk 	/* Catches 'row < 0' case too */
    284  1.1     ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    285  1.1     ad 		stamp_mutex--;
    286  1.1     ad 		return;
    287  1.1     ad 	}
    288  1.1     ad 
    289  1.1     ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    290  1.1     ad 		stamp_mutex--;
    291  1.1     ad 		return;
    292  1.1     ad 	}
    293  1.1     ad #endif
    294  1.1     ad 
    295  1.1     ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    296  1.1     ad 	height = ri->ri_font->fontheight;
    297  1.1     ad 	rs = ri->ri_stride;
    298  1.5     pk 
    299  1.1     ad 	/* Recompute stamp? */
    300  1.1     ad 	if (attr != stamp_attr)
    301  1.1     ad 		rasops2_makestamp(ri, attr);
    302  1.5     pk 
    303  1.1     ad 	if (uc == ' ') {
    304  1.5     pk 		int8_t c = stamp[0];
    305  1.1     ad 		while (height--) {
    306  1.5     pk 			*(int16_t *)rp = c;
    307  1.1     ad 			rp += rs;
    308  1.1     ad 		}
    309  1.1     ad 	} else {
    310  1.1     ad 		uc -= ri->ri_font->firstchar;
    311  1.1     ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    312  1.1     ad 		fs = ri->ri_font->stride;
    313  1.5     pk 
    314  1.1     ad 		while (height--) {
    315  1.5     pk 			rp[0] = stamp[(*fr >> 4) & 0xf];
    316  1.5     pk 			rp[1] = stamp[*fr & 0xf];
    317  1.1     ad 			fr += fs;
    318  1.1     ad 			rp += rs;
    319  1.1     ad 		}
    320  1.1     ad 	}
    321  1.1     ad 
    322  1.1     ad 	/* Do underline */
    323  1.4     ad 	if ((attr & 1) != 0)
    324  1.1     ad 		*(int16_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
    325  1.5     pk 
    326  1.1     ad 	stamp_mutex--;
    327  1.1     ad }
    328  1.1     ad 
    329  1.1     ad /*
    330  1.1     ad  * Put a single character. This is for 12-pixel wide fonts.
    331  1.1     ad  */
    332  1.1     ad static void
    333  1.1     ad rasops2_putchar12(cookie, row, col, uc, attr)
    334  1.1     ad 	void *cookie;
    335  1.1     ad 	int row, col;
    336  1.1     ad 	u_int uc;
    337  1.1     ad 	long attr;
    338  1.1     ad {
    339  1.1     ad 	struct rasops_info *ri;
    340  1.1     ad 	int height, fs, rs;
    341  1.1     ad 	u_char *fr, *rp;
    342  1.5     pk 
    343  1.1     ad 	/* Can't risk remaking the stamp if it's already in use */
    344  1.1     ad 	if (stamp_mutex++) {
    345  1.1     ad 		stamp_mutex--;
    346  1.1     ad 		rasops2_putchar(cookie, row, col, uc, attr);
    347  1.1     ad 		return;
    348  1.1     ad 	}
    349  1.1     ad 
    350  1.1     ad 	ri = (struct rasops_info *)cookie;
    351  1.1     ad 
    352  1.5     pk #ifdef RASOPS_CLIPPING
    353  1.5     pk 	/* Catches 'row < 0' case too */
    354  1.1     ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    355  1.1     ad 		stamp_mutex--;
    356  1.1     ad 		return;
    357  1.1     ad 	}
    358  1.1     ad 
    359  1.1     ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    360  1.1     ad 		stamp_mutex--;
    361  1.1     ad 		return;
    362  1.1     ad 	}
    363  1.1     ad #endif
    364  1.1     ad 
    365  1.1     ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    366  1.1     ad 	height = ri->ri_font->fontheight;
    367  1.1     ad 	rs = ri->ri_stride;
    368  1.5     pk 
    369  1.1     ad 	/* Recompute stamp? */
    370  1.1     ad 	if (attr != stamp_attr)
    371  1.1     ad 		rasops2_makestamp(ri, attr);
    372  1.5     pk 
    373  1.1     ad 	if (uc == ' ') {
    374  1.5     pk 		int8_t c = stamp[0];
    375  1.1     ad 		while (height--) {
    376  1.5     pk 			rp[0] = rp[1] = rp[2] = c;
    377  1.1     ad 			rp += rs;
    378  1.1     ad 		}
    379  1.1     ad 	} else {
    380  1.1     ad 		uc -= ri->ri_font->firstchar;
    381  1.1     ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    382  1.1     ad 		fs = ri->ri_font->stride;
    383  1.5     pk 
    384  1.1     ad 		while (height--) {
    385  1.5     pk 			rp[0] = stamp[(fr[0] >> 4) & 0xf];
    386  1.5     pk 			rp[1] = stamp[fr[0] & 0xf];
    387  1.5     pk 			rp[2] = stamp[(fr[1] >> 4) & 0xf];
    388  1.1     ad 			fr += fs;
    389  1.1     ad 			rp += rs;
    390  1.1     ad 		}
    391  1.1     ad 	}
    392  1.1     ad 
    393  1.1     ad 	/* Do underline */
    394  1.4     ad 	if ((attr & 1) != 0) {
    395  1.1     ad 		rp -= ri->ri_stride << 1;
    396  1.5     pk 		rp[0] = rp[1] = rp[2] = stamp[15];
    397  1.1     ad 	}
    398  1.5     pk 
    399  1.1     ad 	stamp_mutex--;
    400  1.1     ad }
    401  1.1     ad 
    402  1.1     ad /*
    403  1.1     ad  * Put a single character. This is for 16-pixel wide fonts.
    404  1.1     ad  */
    405  1.1     ad static void
    406  1.1     ad rasops2_putchar16(cookie, row, col, uc, attr)
    407  1.1     ad 	void *cookie;
    408  1.1     ad 	int row, col;
    409  1.1     ad 	u_int uc;
    410  1.1     ad 	long attr;
    411  1.1     ad {
    412  1.1     ad 	struct rasops_info *ri;
    413  1.1     ad 	int height, fs, rs;
    414  1.1     ad 	u_char *fr, *rp;
    415  1.5     pk 
    416  1.1     ad 	/* Can't risk remaking the stamp if it's already in use */
    417  1.1     ad 	if (stamp_mutex++) {
    418  1.1     ad 		stamp_mutex--;
    419  1.1     ad 		rasops2_putchar(cookie, row, col, uc, attr);
    420  1.1     ad 		return;
    421  1.1     ad 	}
    422  1.1     ad 
    423  1.1     ad 	ri = (struct rasops_info *)cookie;
    424  1.1     ad 
    425  1.5     pk #ifdef RASOPS_CLIPPING
    426  1.5     pk 	/* Catches 'row < 0' case too */
    427  1.1     ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    428  1.1     ad 		stamp_mutex--;
    429  1.1     ad 		return;
    430  1.1     ad 	}
    431  1.1     ad 
    432  1.1     ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    433  1.1     ad 		stamp_mutex--;
    434  1.1     ad 		return;
    435  1.1     ad 	}
    436  1.1     ad #endif
    437  1.1     ad 
    438  1.1     ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    439  1.1     ad 	height = ri->ri_font->fontheight;
    440  1.1     ad 	rs = ri->ri_stride;
    441  1.5     pk 
    442  1.1     ad 	/* Recompute stamp? */
    443  1.1     ad 	if (attr != stamp_attr)
    444  1.1     ad 		rasops2_makestamp(ri, attr);
    445  1.5     pk 
    446  1.1     ad 	if (uc == ' ') {
    447  1.5     pk 		int8_t c = stamp[0];
    448  1.1     ad 		while (height--) {
    449  1.5     pk 			*(int32_t *)rp = c;
    450  1.1     ad 			rp += rs;
    451  1.1     ad 		}
    452  1.1     ad 	} else {
    453  1.1     ad 		uc -= ri->ri_font->firstchar;
    454  1.1     ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    455  1.1     ad 		fs = ri->ri_font->stride;
    456  1.5     pk 
    457  1.1     ad 		while (height--) {
    458  1.5     pk 			rp[0] = stamp[(fr[0] >> 4) & 0xf];
    459  1.5     pk 			rp[1] = stamp[fr[0] & 0xf];
    460  1.5     pk 			rp[2] = stamp[(fr[1] >> 4) & 0xf];
    461  1.5     pk 			rp[3] = stamp[fr[1] & 0xf];
    462  1.1     ad 			fr += fs;
    463  1.1     ad 			rp += rs;
    464  1.1     ad 		}
    465  1.1     ad 	}
    466  1.1     ad 
    467  1.1     ad 	/* Do underline */
    468  1.4     ad 	if ((attr & 1) != 0)
    469  1.1     ad 		*(int32_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
    470  1.5     pk 
    471  1.1     ad 	stamp_mutex--;
    472  1.1     ad }
    473  1.4     ad #endif	/* !RASOPS_SMALL */
    474  1.1     ad 
    475  1.1     ad /*
    476  1.1     ad  * Grab routines common to depths where (bpp < 8)
    477  1.1     ad  */
    478  1.1     ad #define NAME(ident)	rasops2_##ident
    479  1.1     ad #define PIXEL_SHIFT	1
    480  1.1     ad 
    481  1.1     ad #include <dev/rasops/rasops_bitops.h>
    482