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