Home | History | Annotate | Line # | Download | only in rasops
rasops2.c revision 1.3.6.1
      1  1.3.6.1  wrstuden /* 	$NetBSD: rasops2.c,v 1.3.6.1 1999/12/27 18:35:30 wrstuden 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.3.6.1  wrstuden __KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.3.6.1 1999/12/27 18:35:30 wrstuden 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.3.6.1  wrstuden static void	rasops2_copycols __P((void *, int, int, int, int));
     55  1.3.6.1  wrstuden static void	rasops2_erasecols __P((void *, int, int, int, long));
     56  1.3.6.1  wrstuden 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.3.6.1  wrstuden #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.3.6.1  wrstuden #endif
     64      1.1        ad 
     65      1.1        ad /*
     66      1.1        ad  * 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.3.6.1  wrstuden #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.3.6.1  wrstuden #endif	/* !RASOPS_SMALL */
     92      1.1        ad 	default:
     93  1.3.6.1  wrstuden 		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.1        ad 
     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.3.6.1  wrstuden #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.1        ad 
    121      1.1        ad 	ri = (struct rasops_info *)cookie;
    122      1.1        ad 
    123      1.1        ad #ifdef RASOPS_CLIPPING
    124      1.1        ad 	/* 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.1        ad 
    139      1.1        ad 	bg = ri->ri_devcmap[(attr >> 16) & 15];
    140      1.1        ad 	fg = ri->ri_devcmap[(attr >> 24) & 15];
    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.1        ad 
    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.1        ad 
    158      1.1        ad 		if (uc == (u_int)-1) {
    159      1.1        ad 			bg &= rmask;
    160      1.1        ad 
    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.1        ad 
    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.1        ad 
    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.1        ad 
    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.1        ad 
    195      1.1        ad 			/* NOT fontbits if bg is white */
    196      1.1        ad 			while (height--) {
    197      1.1        ad 				fb = ~(fr[3] | (fr[2] << 8) |
    198      1.1        ad 				    (fr[1] << 16) | (fr[0] << 24));
    199      1.1        ad 
    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.3.6.1  wrstuden #ifndef RASOPS_SMALL
    236  1.3.6.1  wrstuden /*
    237  1.3.6.1  wrstuden  * Recompute the blitting stamp.
    238  1.3.6.1  wrstuden  */
    239  1.3.6.1  wrstuden static void
    240  1.3.6.1  wrstuden rasops2_makestamp(ri, attr)
    241  1.3.6.1  wrstuden 	struct rasops_info *ri;
    242  1.3.6.1  wrstuden 	long attr;
    243  1.3.6.1  wrstuden {
    244  1.3.6.1  wrstuden 	int i, fg, bg;
    245  1.3.6.1  wrstuden 
    246  1.3.6.1  wrstuden 	fg = ri->ri_devcmap[(attr >> 24) & 15] & 3;
    247  1.3.6.1  wrstuden 	bg = ri->ri_devcmap[(attr >> 16) & 15] & 3;
    248  1.3.6.1  wrstuden 	stamp_attr = attr;
    249  1.3.6.1  wrstuden 
    250  1.3.6.1  wrstuden 	for (i = 0; i < 16; i++) {
    251  1.3.6.1  wrstuden 		stamp[i] = (i & 1 ? fg : bg);
    252  1.3.6.1  wrstuden 		stamp[i] |= (i & 2 ? fg : bg) << 2;
    253  1.3.6.1  wrstuden 		stamp[i] |= (i & 4 ? fg : bg) << 4;
    254  1.3.6.1  wrstuden 		stamp[i] |= (i & 8 ? fg : bg) << 6;
    255  1.3.6.1  wrstuden 	}
    256  1.3.6.1  wrstuden }
    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.1        ad 
    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.1        ad #ifdef RASOPS_CLIPPING
    282      1.1        ad 	/* 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.1        ad 
    298      1.1        ad 	/* Recompute stamp? */
    299      1.1        ad 	if (attr != stamp_attr)
    300      1.1        ad 		rasops2_makestamp(ri, attr);
    301      1.1        ad 
    302      1.1        ad 	if (uc == ' ') {
    303      1.1        ad 		while (height--) {
    304      1.1        ad 			*(int16_t *)rp = stamp[0];
    305      1.1        ad 			rp += rs;
    306      1.1        ad 		}
    307      1.1        ad 	} else {
    308      1.1        ad 		uc -= ri->ri_font->firstchar;
    309      1.1        ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    310      1.1        ad 		fs = ri->ri_font->stride;
    311      1.1        ad 
    312      1.1        ad 		while (height--) {
    313      1.1        ad 			rp[0] = stamp[(*fr >> 4) & 15];
    314      1.1        ad 			rp[1] = stamp[*fr & 15];
    315      1.1        ad 			fr += fs;
    316      1.1        ad 			rp += rs;
    317      1.1        ad 		}
    318      1.1        ad 	}
    319      1.1        ad 
    320      1.1        ad 	/* Do underline */
    321  1.3.6.1  wrstuden 	if ((attr & 1) != 0)
    322      1.1        ad 		*(int16_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
    323      1.1        ad 
    324      1.1        ad 	stamp_mutex--;
    325      1.1        ad }
    326      1.1        ad 
    327      1.1        ad /*
    328      1.1        ad  * Put a single character. This is for 12-pixel wide fonts.
    329      1.1        ad  */
    330      1.1        ad static void
    331      1.1        ad rasops2_putchar12(cookie, row, col, uc, attr)
    332      1.1        ad 	void *cookie;
    333      1.1        ad 	int row, col;
    334      1.1        ad 	u_int uc;
    335      1.1        ad 	long attr;
    336      1.1        ad {
    337      1.1        ad 	struct rasops_info *ri;
    338      1.1        ad 	int height, fs, rs;
    339      1.1        ad 	u_char *fr, *rp;
    340      1.1        ad 
    341      1.1        ad 	/* Can't risk remaking the stamp if it's already in use */
    342      1.1        ad 	if (stamp_mutex++) {
    343      1.1        ad 		stamp_mutex--;
    344      1.1        ad 		rasops2_putchar(cookie, row, col, uc, attr);
    345      1.1        ad 		return;
    346      1.1        ad 	}
    347      1.1        ad 
    348      1.1        ad 	ri = (struct rasops_info *)cookie;
    349      1.1        ad 
    350      1.1        ad #ifdef RASOPS_CLIPPING
    351      1.1        ad 	/* Catches 'row < 0' case too */
    352      1.1        ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    353      1.1        ad 		stamp_mutex--;
    354      1.1        ad 		return;
    355      1.1        ad 	}
    356      1.1        ad 
    357      1.1        ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    358      1.1        ad 		stamp_mutex--;
    359      1.1        ad 		return;
    360      1.1        ad 	}
    361      1.1        ad #endif
    362      1.1        ad 
    363      1.1        ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    364      1.1        ad 	height = ri->ri_font->fontheight;
    365      1.1        ad 	rs = ri->ri_stride;
    366      1.1        ad 
    367      1.1        ad 	/* Recompute stamp? */
    368      1.1        ad 	if (attr != stamp_attr)
    369      1.1        ad 		rasops2_makestamp(ri, attr);
    370      1.1        ad 
    371      1.1        ad 	if (uc == ' ') {
    372      1.1        ad 		while (height--) {
    373      1.1        ad 			rp[0] = stamp[0];
    374      1.1        ad 			rp[1] = stamp[0];
    375      1.1        ad 			rp[2] = stamp[0];
    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.1        ad 
    383      1.1        ad 		while (height--) {
    384      1.1        ad 			rp[0] = stamp[(fr[0] >> 4) & 15];
    385      1.1        ad 			rp[1] = stamp[fr[0] & 15];
    386      1.1        ad 			rp[2] = stamp[(fr[1] >> 4) & 15];
    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.3.6.1  wrstuden 	if ((attr & 1) != 0) {
    394      1.1        ad 		rp -= ri->ri_stride << 1;
    395      1.1        ad 		rp[0] = stamp[15];
    396      1.1        ad 		rp[1] = stamp[15];
    397      1.1        ad 		rp[2] = stamp[15];
    398      1.1        ad 	}
    399      1.1        ad 
    400      1.1        ad 	stamp_mutex--;
    401      1.1        ad }
    402      1.1        ad 
    403      1.1        ad /*
    404      1.1        ad  * Put a single character. This is for 16-pixel wide fonts.
    405      1.1        ad  */
    406      1.1        ad static void
    407      1.1        ad rasops2_putchar16(cookie, row, col, uc, attr)
    408      1.1        ad 	void *cookie;
    409      1.1        ad 	int row, col;
    410      1.1        ad 	u_int uc;
    411      1.1        ad 	long attr;
    412      1.1        ad {
    413      1.1        ad 	struct rasops_info *ri;
    414      1.1        ad 	int height, fs, rs;
    415      1.1        ad 	u_char *fr, *rp;
    416      1.1        ad 
    417      1.1        ad 	/* Can't risk remaking the stamp if it's already in use */
    418      1.1        ad 	if (stamp_mutex++) {
    419      1.1        ad 		stamp_mutex--;
    420      1.1        ad 		rasops2_putchar(cookie, row, col, uc, attr);
    421      1.1        ad 		return;
    422      1.1        ad 	}
    423      1.1        ad 
    424      1.1        ad 	ri = (struct rasops_info *)cookie;
    425      1.1        ad 
    426      1.1        ad #ifdef RASOPS_CLIPPING
    427      1.1        ad 	/* Catches 'row < 0' case too */
    428      1.1        ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    429      1.1        ad 		stamp_mutex--;
    430      1.1        ad 		return;
    431      1.1        ad 	}
    432      1.1        ad 
    433      1.1        ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    434      1.1        ad 		stamp_mutex--;
    435      1.1        ad 		return;
    436      1.1        ad 	}
    437      1.1        ad #endif
    438      1.1        ad 
    439      1.1        ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    440      1.1        ad 	height = ri->ri_font->fontheight;
    441      1.1        ad 	rs = ri->ri_stride;
    442      1.1        ad 
    443      1.1        ad 	/* Recompute stamp? */
    444      1.1        ad 	if (attr != stamp_attr)
    445      1.1        ad 		rasops2_makestamp(ri, attr);
    446      1.1        ad 
    447      1.1        ad 	if (uc == ' ') {
    448      1.1        ad 		while (height--) {
    449      1.1        ad 			*(int32_t *)rp = stamp[0];
    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.1        ad 
    457      1.1        ad 		while (height--) {
    458      1.1        ad 			rp[0] = stamp[(fr[0] >> 4) & 15];
    459      1.1        ad 			rp[1] = stamp[fr[0] & 15];
    460      1.1        ad 			rp[2] = stamp[(fr[1] >> 4) & 15];
    461      1.1        ad 			rp[3] = stamp[fr[1] & 15];
    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.3.6.1  wrstuden 	if ((attr & 1) != 0)
    469      1.1        ad 		*(int32_t *)(rp - (ri->ri_stride << 1)) = stamp[15];
    470      1.1        ad 
    471      1.1        ad 	stamp_mutex--;
    472      1.1        ad }
    473  1.3.6.1  wrstuden #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