Home | History | Annotate | Line # | Download | only in rasops
rasops2.c revision 1.5
      1  1.5  pk /* 	$NetBSD: rasops2.c,v 1.5 2000/04/12 14:22:29 pk 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.2  ad  * by Andy 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.1  ad #include "opt_rasops.h"
     40  1.1  ad #include <sys/cdefs.h>
     41  1.5  pk __KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.5 2000/04/12 14:22:29 pk Exp $");
     42  1.1  ad 
     43  1.1  ad #include <sys/types.h>
     44  1.1  ad #include <sys/param.h>
     45  1.1  ad #include <sys/systm.h>
     46  1.1  ad #include <sys/time.h>
     47  1.1  ad #include <machine/endian.h>
     48  1.1  ad 
     49  1.1  ad #include <dev/wscons/wsdisplayvar.h>
     50  1.1  ad #include <dev/wscons/wsconsio.h>
     51  1.1  ad #include <dev/rasops/rasops.h>
     52  1.1  ad #include <dev/rasops/rasops_masks.h>
     53  1.1  ad 
     54  1.4  ad static void	rasops2_copycols __P((void *, int, int, int, int));
     55  1.4  ad static void	rasops2_erasecols __P((void *, int, int, int, long));
     56  1.4  ad static void	rasops2_do_cursor __P((struct rasops_info *));
     57  1.1  ad static void	rasops2_putchar __P((void *, int, int col, u_int, long));
     58  1.4  ad #ifndef RASOPS_SMALL
     59  1.1  ad static void	rasops2_putchar8 __P((void *, int, int col, u_int, long));
     60  1.1  ad static void	rasops2_putchar12 __P((void *, int, int col, u_int, long));
     61  1.1  ad static void	rasops2_putchar16 __P((void *, int, int col, u_int, long));
     62  1.1  ad static void	rasops2_makestamp __P((struct rasops_info *, long));
     63  1.4  ad #endif
     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.1  ad 
     72  1.1  ad /*
     73  1.1  ad  * Initialize rasops_info struct for this colordepth.
     74  1.1  ad  */
     75  1.1  ad void
     76  1.1  ad rasops2_init(ri)
     77  1.1  ad 	struct rasops_info *ri;
     78  1.1  ad {
     79  1.1  ad 
     80  1.1  ad 	switch (ri->ri_font->fontwidth) {
     81  1.4  ad #ifndef RASOPS_SMALL
     82  1.1  ad 	case 8:
     83  1.1  ad 		ri->ri_ops.putchar = rasops2_putchar8;
     84  1.1  ad 		break;
     85  1.1  ad 	case 12:
     86  1.1  ad 		ri->ri_ops.putchar = rasops2_putchar12;
     87  1.1  ad 		break;
     88  1.1  ad 	case 16:
     89  1.1  ad 		ri->ri_ops.putchar = rasops2_putchar16;
     90  1.1  ad 		break;
     91  1.4  ad #endif	/* !RASOPS_SMALL */
     92  1.1  ad 	default:
     93  1.4  ad 		panic("fontwidth not 8/12/16 or RASOPS_SMALL - fixme!");
     94  1.1  ad 		ri->ri_ops.putchar = rasops2_putchar;
     95  1.1  ad 		break;
     96  1.1  ad 	}
     97  1.5  pk 
     98  1.3  ad 	if ((ri->ri_font->fontwidth & 3) != 0) {
     99  1.1  ad 		ri->ri_ops.erasecols = rasops2_erasecols;
    100  1.1  ad 		ri->ri_ops.copycols = rasops2_copycols;
    101  1.1  ad 		ri->ri_do_cursor = rasops2_do_cursor;
    102  1.1  ad 	}
    103  1.1  ad }
    104  1.1  ad 
    105  1.4  ad #ifdef notyet
    106  1.1  ad /*
    107  1.1  ad  * Paint a single character. This is the generic version, this is ugly.
    108  1.1  ad  */
    109  1.1  ad static void
    110  1.1  ad rasops2_putchar(cookie, row, col, uc, attr)
    111  1.1  ad 	void *cookie;
    112  1.1  ad 	int row, col;
    113  1.1  ad 	u_int uc;
    114  1.1  ad 	long attr;
    115  1.1  ad {
    116  1.1  ad 	int height, width, fs, rs, fb, bg, fg, lmask, rmask;
    117  1.1  ad 	struct rasops_info *ri;
    118  1.1  ad 	int32_t *rp;
    119  1.1  ad 	u_char *fr;
    120  1.5  pk 
    121  1.1  ad 	ri = (struct rasops_info *)cookie;
    122  1.1  ad 
    123  1.5  pk #ifdef RASOPS_CLIPPING
    124  1.5  pk 	/* Catches 'row < 0' case too */
    125  1.1  ad 	if ((unsigned)row >= (unsigned)ri->ri_rows)
    126  1.1  ad 		return;
    127  1.1  ad 
    128  1.1  ad 	if ((unsigned)col >= (unsigned)ri->ri_cols)
    129  1.1  ad 		return;
    130  1.1  ad #endif
    131  1.1  ad 
    132  1.1  ad 	width = ri->ri_font->fontwidth << 1;
    133  1.1  ad 	height = ri->ri_font->fontheight;
    134  1.1  ad 	col *= width;
    135  1.1  ad 	rp = (int32_t *)(ri->ri_bits + row * ri->ri_yscale + ((col >> 3) & ~3));
    136  1.1  ad 	col = col & 31;
    137  1.1  ad 	rs = ri->ri_stride;
    138  1.5  pk 
    139  1.5  pk 	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
    140  1.5  pk 	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
    141  1.1  ad 
    142  1.1  ad 	/* If fg and bg match this becomes a space character */
    143  1.1  ad 	if (fg == bg || uc == ' ') {
    144  1.1  ad 		uc = (u_int)-1;
    145  1.1  ad 		fr = 0;		/* shutup gcc */
    146  1.1  ad 		fs = 0;		/* shutup gcc */
    147  1.1  ad 	} else {
    148  1.1  ad 		uc -= ri->ri_font->firstchar;
    149  1.1  ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    150  1.1  ad 		fs = ri->ri_font->stride;
    151  1.1  ad 	}
    152  1.5  pk 
    153  1.1  ad 	/* Single word, one mask */
    154  1.1  ad 	if ((col + width) <= 32) {
    155  1.1  ad 		rmask = rasops_pmask[col][width];
    156  1.1  ad 		lmask = ~rmask;
    157  1.5  pk 
    158  1.1  ad 		if (uc == (u_int)-1) {
    159  1.1  ad 			bg &= rmask;
    160  1.5  pk 
    161  1.1  ad 			while (height--) {
    162  1.1  ad 				*rp = (*rp & lmask) | bg;
    163  1.1  ad 				DELTA(rp, rs, int32_t *);
    164  1.1  ad 			}
    165  1.1  ad 		} else {
    166  1.1  ad 			while (height--) {
    167  1.1  ad 				/* get bits, mask */
    168  1.1  ad 				/* compose sl */
    169  1.1  ad 				/* mask sl */
    170  1.1  ad 				/* put word */
    171  1.1  ad 			}
    172  1.1  ad 		}
    173  1.5  pk 
    174  1.1  ad 		/* Do underline */
    175  1.1  ad 		if (attr & 1) {
    176  1.1  ad 			DELTA(rp, -(ri->ri_stride << 1), int32_t *);
    177  1.1  ad 			*rp = (*rp & lmask) | (fg & rmask);
    178  1.1  ad 		}
    179  1.1  ad 	} else {
    180  1.1  ad 		lmask = ~rasops_lmask[col];
    181  1.1  ad 		rmask = ~rasops_rmask[(col + width) & 31];
    182  1.5  pk 
    183  1.1  ad 		if (uc == (u_int)-1) {
    184  1.1  ad 			bg = bg & ~lmask;
    185  1.1  ad 			width = bg & ~rmask;
    186  1.5  pk 
    187  1.1  ad 			while (height--) {
    188  1.1  ad 				rp[0] = (rp[0] & lmask) | bg;
    189  1.1  ad 				rp[1] = (rp[1] & rmask) | width;
    190  1.1  ad 				DELTA(rp, rs, int32_t *);
    191  1.1  ad 			}
    192  1.1  ad 		} else {
    193  1.1  ad 			width = 32 - col;
    194  1.5  pk 
    195  1.1  ad 			/* NOT fontbits if bg is white */
    196  1.1  ad 			while (height--) {
    197  1.5  pk 				fb = ~(fr[3] | (fr[2] << 8) |
    198  1.1  ad 				    (fr[1] << 16) | (fr[0] << 24));
    199  1.5  pk 
    200  1.1  ad 				rp[0] = (rp[0] & lmask)
    201  1.1  ad 				    | MBE((u_int)fb >> col);
    202  1.1  ad 
    203  1.1  ad 				rp[1] = (rp[1] & rmask)
    204  1.1  ad 				   | (MBE((u_int)fb << width) & ~rmask);
    205  1.1  ad 
    206  1.1  ad 				fr += fs;
    207  1.1  ad 				DELTA(rp, rs, int32_t *);
    208  1.1  ad 			}
    209  1.1  ad 		}
    210  1.1  ad 
    211  1.1  ad 		/* Do underline */
    212  1.1  ad 		if (attr & 1) {
    213  1.1  ad 			DELTA(rp, -(ri->ri_stride << 1), int32_t *);
    214  1.1  ad 			rp[0] = (rp[0] & lmask) | (fg & ~lmask);
    215  1.1  ad 			rp[1] = (rp[1] & rmask) | (fg & ~rmask);
    216  1.1  ad 		}
    217  1.1  ad 	}
    218  1.1  ad }
    219  1.1  ad #endif
    220  1.1  ad 
    221  1.1  ad /*
    222  1.1  ad  * Put a single character. This is the generic version.
    223  1.1  ad  */
    224  1.1  ad static void
    225  1.1  ad rasops2_putchar(cookie, row, col, uc, attr)
    226  1.1  ad 	void *cookie;
    227  1.1  ad 	int row, col;
    228  1.1  ad 	u_int uc;
    229  1.1  ad 	long attr;
    230  1.1  ad {
    231  1.1  ad 
    232  1.1  ad 	/* XXX punt */
    233  1.1  ad }
    234  1.1  ad 
    235  1.4  ad #ifndef RASOPS_SMALL
    236  1.4  ad /*
    237  1.4  ad  * Recompute the blitting stamp.
    238  1.4  ad  */
    239  1.4  ad static void
    240  1.4  ad rasops2_makestamp(ri, attr)
    241  1.4  ad 	struct rasops_info *ri;
    242  1.4  ad 	long attr;
    243  1.4  ad {
    244  1.4  ad 	int i, fg, bg;
    245  1.5  pk 
    246  1.5  pk 	fg = ri->ri_devcmap[(attr >> 24) & 0xf] & 3;
    247  1.5  pk 	bg = ri->ri_devcmap[(attr >> 16) & 0xf] & 3;
    248  1.4  ad 	stamp_attr = attr;
    249  1.5  pk 
    250  1.4  ad 	for (i = 0; i < 16; i++) {
    251  1.4  ad 		stamp[i] = (i & 1 ? fg : bg);
    252  1.4  ad 		stamp[i] |= (i & 2 ? fg : bg) << 2;
    253  1.4  ad 		stamp[i] |= (i & 4 ? fg : bg) << 4;
    254  1.4  ad 		stamp[i] |= (i & 8 ? fg : bg) << 6;
    255  1.4  ad 	}
    256  1.4  ad }
    257  1.1  ad 
    258  1.1  ad /*
    259  1.1  ad  * Put a single character. This is for 8-pixel wide fonts.
    260  1.1  ad  */
    261  1.1  ad static void
    262  1.1  ad rasops2_putchar8(cookie, row, col, uc, attr)
    263  1.1  ad 	void *cookie;
    264  1.1  ad 	int row, col;
    265  1.1  ad 	u_int uc;
    266  1.1  ad 	long attr;
    267  1.1  ad {
    268  1.1  ad 	struct rasops_info *ri;
    269  1.1  ad 	int height, fs, rs;
    270  1.1  ad 	u_char *fr, *rp;
    271  1.5  pk 
    272  1.1  ad 	/* Can't risk remaking the stamp if it's already in use */
    273  1.1  ad 	if (stamp_mutex++) {
    274  1.1  ad 		stamp_mutex--;
    275  1.1  ad 		rasops2_putchar(cookie, row, col, uc, attr);
    276  1.1  ad 		return;
    277  1.1  ad 	}
    278  1.1  ad 
    279  1.1  ad 	ri = (struct rasops_info *)cookie;
    280  1.1  ad 
    281  1.5  pk #ifdef RASOPS_CLIPPING
    282  1.5  pk 	/* Catches 'row < 0' case too */
    283  1.1  ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    284  1.1  ad 		stamp_mutex--;
    285  1.1  ad 		return;
    286  1.1  ad 	}
    287  1.1  ad 
    288  1.1  ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    289  1.1  ad 		stamp_mutex--;
    290  1.1  ad 		return;
    291  1.1  ad 	}
    292  1.1  ad #endif
    293  1.1  ad 
    294  1.1  ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    295  1.1  ad 	height = ri->ri_font->fontheight;
    296  1.1  ad 	rs = ri->ri_stride;
    297  1.5  pk 
    298  1.1  ad 	/* Recompute stamp? */
    299  1.1  ad 	if (attr != stamp_attr)
    300  1.1  ad 		rasops2_makestamp(ri, attr);
    301  1.5  pk 
    302  1.1  ad 	if (uc == ' ') {
    303  1.5  pk 		int8_t c = stamp[0];
    304  1.1  ad 		while (height--) {
    305  1.5  pk 			*(int16_t *)rp = c;
    306  1.1  ad 			rp += rs;
    307  1.1  ad 		}
    308  1.1  ad 	} else {
    309  1.1  ad 		uc -= ri->ri_font->firstchar;
    310  1.1  ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    311  1.1  ad 		fs = ri->ri_font->stride;
    312  1.5  pk 
    313  1.1  ad 		while (height--) {
    314  1.5  pk 			rp[0] = stamp[(*fr >> 4) & 0xf];
    315  1.5  pk 			rp[1] = stamp[*fr & 0xf];
    316  1.1  ad 			fr += fs;
    317  1.1  ad 			rp += rs;
    318  1.1  ad 		}
    319  1.1  ad 	}
    320  1.1  ad 
    321  1.1  ad 	/* Do underline */
    322  1.4  ad 	if ((attr & 1) != 0)
    323  1.1  ad 		*(int16_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
    324  1.5  pk 
    325  1.1  ad 	stamp_mutex--;
    326  1.1  ad }
    327  1.1  ad 
    328  1.1  ad /*
    329  1.1  ad  * Put a single character. This is for 12-pixel wide fonts.
    330  1.1  ad  */
    331  1.1  ad static void
    332  1.1  ad rasops2_putchar12(cookie, row, col, uc, attr)
    333  1.1  ad 	void *cookie;
    334  1.1  ad 	int row, col;
    335  1.1  ad 	u_int uc;
    336  1.1  ad 	long attr;
    337  1.1  ad {
    338  1.1  ad 	struct rasops_info *ri;
    339  1.1  ad 	int height, fs, rs;
    340  1.1  ad 	u_char *fr, *rp;
    341  1.5  pk 
    342  1.1  ad 	/* Can't risk remaking the stamp if it's already in use */
    343  1.1  ad 	if (stamp_mutex++) {
    344  1.1  ad 		stamp_mutex--;
    345  1.1  ad 		rasops2_putchar(cookie, row, col, uc, attr);
    346  1.1  ad 		return;
    347  1.1  ad 	}
    348  1.1  ad 
    349  1.1  ad 	ri = (struct rasops_info *)cookie;
    350  1.1  ad 
    351  1.5  pk #ifdef RASOPS_CLIPPING
    352  1.5  pk 	/* Catches 'row < 0' case too */
    353  1.1  ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    354  1.1  ad 		stamp_mutex--;
    355  1.1  ad 		return;
    356  1.1  ad 	}
    357  1.1  ad 
    358  1.1  ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    359  1.1  ad 		stamp_mutex--;
    360  1.1  ad 		return;
    361  1.1  ad 	}
    362  1.1  ad #endif
    363  1.1  ad 
    364  1.1  ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    365  1.1  ad 	height = ri->ri_font->fontheight;
    366  1.1  ad 	rs = ri->ri_stride;
    367  1.5  pk 
    368  1.1  ad 	/* Recompute stamp? */
    369  1.1  ad 	if (attr != stamp_attr)
    370  1.1  ad 		rasops2_makestamp(ri, attr);
    371  1.5  pk 
    372  1.1  ad 	if (uc == ' ') {
    373  1.5  pk 		int8_t c = stamp[0];
    374  1.1  ad 		while (height--) {
    375  1.5  pk 			rp[0] = rp[1] = rp[2] = c;
    376  1.1  ad 			rp += rs;
    377  1.1  ad 		}
    378  1.1  ad 	} else {
    379  1.1  ad 		uc -= ri->ri_font->firstchar;
    380  1.1  ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    381  1.1  ad 		fs = ri->ri_font->stride;
    382  1.5  pk 
    383  1.1  ad 		while (height--) {
    384  1.5  pk 			rp[0] = stamp[(fr[0] >> 4) & 0xf];
    385  1.5  pk 			rp[1] = stamp[fr[0] & 0xf];
    386  1.5  pk 			rp[2] = stamp[(fr[1] >> 4) & 0xf];
    387  1.1  ad 			fr += fs;
    388  1.1  ad 			rp += rs;
    389  1.1  ad 		}
    390  1.1  ad 	}
    391  1.1  ad 
    392  1.1  ad 	/* Do underline */
    393  1.4  ad 	if ((attr & 1) != 0) {
    394  1.1  ad 		rp -= ri->ri_stride << 1;
    395  1.5  pk 		rp[0] = rp[1] = rp[2] = stamp[15];
    396  1.1  ad 	}
    397  1.5  pk 
    398  1.1  ad 	stamp_mutex--;
    399  1.1  ad }
    400  1.1  ad 
    401  1.1  ad /*
    402  1.1  ad  * Put a single character. This is for 16-pixel wide fonts.
    403  1.1  ad  */
    404  1.1  ad static void
    405  1.1  ad rasops2_putchar16(cookie, row, col, uc, attr)
    406  1.1  ad 	void *cookie;
    407  1.1  ad 	int row, col;
    408  1.1  ad 	u_int uc;
    409  1.1  ad 	long attr;
    410  1.1  ad {
    411  1.1  ad 	struct rasops_info *ri;
    412  1.1  ad 	int height, fs, rs;
    413  1.1  ad 	u_char *fr, *rp;
    414  1.5  pk 
    415  1.1  ad 	/* Can't risk remaking the stamp if it's already in use */
    416  1.1  ad 	if (stamp_mutex++) {
    417  1.1  ad 		stamp_mutex--;
    418  1.1  ad 		rasops2_putchar(cookie, row, col, uc, attr);
    419  1.1  ad 		return;
    420  1.1  ad 	}
    421  1.1  ad 
    422  1.1  ad 	ri = (struct rasops_info *)cookie;
    423  1.1  ad 
    424  1.5  pk #ifdef RASOPS_CLIPPING
    425  1.5  pk 	/* Catches 'row < 0' case too */
    426  1.1  ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    427  1.1  ad 		stamp_mutex--;
    428  1.1  ad 		return;
    429  1.1  ad 	}
    430  1.1  ad 
    431  1.1  ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    432  1.1  ad 		stamp_mutex--;
    433  1.1  ad 		return;
    434  1.1  ad 	}
    435  1.1  ad #endif
    436  1.1  ad 
    437  1.1  ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    438  1.1  ad 	height = ri->ri_font->fontheight;
    439  1.1  ad 	rs = ri->ri_stride;
    440  1.5  pk 
    441  1.1  ad 	/* Recompute stamp? */
    442  1.1  ad 	if (attr != stamp_attr)
    443  1.1  ad 		rasops2_makestamp(ri, attr);
    444  1.5  pk 
    445  1.1  ad 	if (uc == ' ') {
    446  1.5  pk 		int8_t c = stamp[0];
    447  1.1  ad 		while (height--) {
    448  1.5  pk 			*(int32_t *)rp = c;
    449  1.1  ad 			rp += rs;
    450  1.1  ad 		}
    451  1.1  ad 	} else {
    452  1.1  ad 		uc -= ri->ri_font->firstchar;
    453  1.1  ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    454  1.1  ad 		fs = ri->ri_font->stride;
    455  1.5  pk 
    456  1.1  ad 		while (height--) {
    457  1.5  pk 			rp[0] = stamp[(fr[0] >> 4) & 0xf];
    458  1.5  pk 			rp[1] = stamp[fr[0] & 0xf];
    459  1.5  pk 			rp[2] = stamp[(fr[1] >> 4) & 0xf];
    460  1.5  pk 			rp[3] = stamp[fr[1] & 0xf];
    461  1.1  ad 			fr += fs;
    462  1.1  ad 			rp += rs;
    463  1.1  ad 		}
    464  1.1  ad 	}
    465  1.1  ad 
    466  1.1  ad 	/* Do underline */
    467  1.4  ad 	if ((attr & 1) != 0)
    468  1.1  ad 		*(int32_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
    469  1.5  pk 
    470  1.1  ad 	stamp_mutex--;
    471  1.1  ad }
    472  1.4  ad #endif	/* !RASOPS_SMALL */
    473  1.1  ad 
    474  1.1  ad /*
    475  1.1  ad  * Grab routines common to depths where (bpp < 8)
    476  1.1  ad  */
    477  1.1  ad #define NAME(ident)	rasops2_##ident
    478  1.1  ad #define PIXEL_SHIFT	1
    479  1.1  ad 
    480  1.1  ad #include <dev/rasops/rasops_bitops.h>
    481