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