Home | History | Annotate | Line # | Download | only in rasops
rasops15.c revision 1.4
      1  1.4  ad /* 	$NetBSD: rasops15.c,v 1.4 1999/05/18 21:51:59 ad Exp $ */
      2  1.1  ad 
      3  1.4  ad /*-
      4  1.4  ad  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  1.1  ad  * All rights reserved.
      6  1.1  ad  *
      7  1.4  ad  * This code is derived from software contributed to The NetBSD Foundation
      8  1.4  ad  * by Andy Doran.
      9  1.4  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.4  ad  * 3. All advertising materials mentioning features or use of this software
     19  1.4  ad  *    must display the following acknowledgement:
     20  1.4  ad  *	This product includes software developed by the NetBSD
     21  1.4  ad  *	Foundation, Inc. and its contributors.
     22  1.4  ad  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.4  ad  *    contributors may be used to endorse or promote products derived
     24  1.4  ad  *    from this software without specific prior written permission.
     25  1.1  ad  *
     26  1.4  ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.4  ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.4  ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.4  ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.4  ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.4  ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.4  ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.4  ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.4  ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.4  ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.4  ad  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1  ad  */
     38  1.2  ad 
     39  1.1  ad #include "opt_rasops.h"
     40  1.1  ad #include <sys/cdefs.h>
     41  1.4  ad __KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.4 1999/05/18 21:51:59 ad 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 
     48  1.1  ad #include <dev/wscons/wsdisplayvar.h>
     49  1.1  ad #include <dev/wscons/wsconsio.h>
     50  1.1  ad #include <dev/rasops/rasops.h>
     51  1.1  ad 
     52  1.1  ad static void 	rasops15_putchar __P((void *, int, int, u_int, long attr));
     53  1.1  ad static void 	rasops15_putchar8 __P((void *, int, int, u_int, long attr));
     54  1.1  ad static void 	rasops15_putchar12 __P((void *, int, int, u_int, long attr));
     55  1.1  ad static void 	rasops15_putchar16 __P((void *, int, int, u_int, long attr));
     56  1.1  ad static void	rasops15_makestamp __P((struct rasops_info *, long));
     57  1.1  ad 
     58  1.1  ad void	rasops15_init __P((struct rasops_info *ri));
     59  1.1  ad 
     60  1.1  ad /*
     61  1.1  ad  * (2x2)x1 stamp for optimized character blitting
     62  1.1  ad  */
     63  1.1  ad static int32_t	stamp[32];
     64  1.1  ad static long	stamp_attr;
     65  1.1  ad static int	stamp_mutex;	/* XXX see note in readme */
     66  1.1  ad 
     67  1.1  ad /*
     68  1.1  ad  * XXX this confuses the hell out of gcc2 (not egcs) which always insists
     69  1.1  ad  * that the shift count is negative.
     70  1.1  ad  *
     71  1.1  ad  * offset = STAMP_SHIFT(fontbits, nibble #) & STAMP_MASK
     72  1.1  ad  * destination int32_t[0] = STAMP_READ(offset)
     73  1.1  ad  * destination int32_t[1] = STAMP_READ(offset + 4)
     74  1.1  ad  */
     75  1.1  ad #define STAMP_SHIFT(fb,n)	((n*4-3) >= 0 ? (fb)>>(n*4-3):(fb)<<-(n*4-3))
     76  1.1  ad #define STAMP_MASK		(15 << 3)
     77  1.1  ad #define STAMP_READ(o)		(*(int32_t *)((caddr_t)stamp + (o)))
     78  1.1  ad 
     79  1.1  ad 
     80  1.1  ad /*
     81  1.1  ad  * Initalize rasops_info struct for this colordepth.
     82  1.1  ad  */
     83  1.1  ad void
     84  1.1  ad rasops15_init(ri)
     85  1.1  ad 	struct rasops_info *ri;
     86  1.1  ad {
     87  1.1  ad 
     88  1.1  ad 	switch (ri->ri_font->fontwidth) {
     89  1.1  ad 	case 8:
     90  1.1  ad 		ri->ri_ops.putchar = rasops15_putchar8;
     91  1.1  ad 		break;
     92  1.1  ad 
     93  1.1  ad 	case 12:
     94  1.1  ad 		ri->ri_ops.putchar = rasops15_putchar12;
     95  1.1  ad 		break;
     96  1.1  ad 
     97  1.1  ad 	case 16:
     98  1.1  ad 		ri->ri_ops.putchar = rasops15_putchar16;
     99  1.1  ad 		break;
    100  1.3  ad 
    101  1.1  ad 	default:
    102  1.1  ad 		ri->ri_ops.putchar = rasops15_putchar;
    103  1.1  ad 		break;
    104  1.1  ad 	}
    105  1.1  ad 
    106  1.1  ad 	if (ri->ri_rnum == 0) {
    107  1.1  ad 		ri->ri_rnum = 5;
    108  1.1  ad 		ri->ri_rpos = 0;
    109  1.1  ad 		ri->ri_gnum = 5 + (ri->ri_depth == 16);
    110  1.1  ad 		ri->ri_gpos = 5;
    111  1.1  ad 		ri->ri_bnum = 5;
    112  1.1  ad 		ri->ri_bpos = 10 + (ri->ri_depth == 16);
    113  1.1  ad 	}
    114  1.1  ad }
    115  1.1  ad 
    116  1.1  ad 
    117  1.1  ad /*
    118  1.1  ad  * Paint a single character.
    119  1.1  ad  */
    120  1.1  ad static void
    121  1.1  ad rasops15_putchar(cookie, row, col, uc, attr)
    122  1.1  ad 	void *cookie;
    123  1.1  ad 	int row, col;
    124  1.1  ad 	u_int uc;
    125  1.1  ad 	long attr;
    126  1.1  ad {
    127  1.1  ad 	struct rasops_info *ri;
    128  1.1  ad 	int fb, width, height, cnt, clr[2];
    129  1.1  ad 	u_char *dp, *rp, *fr;
    130  1.1  ad 
    131  1.1  ad 	ri = (struct rasops_info *)cookie;
    132  1.1  ad 
    133  1.1  ad #ifdef RASOPS_CLIPPING
    134  1.1  ad 	/* Catches 'row < 0' case too */
    135  1.1  ad 	if ((unsigned)row >= (unsigned)ri->ri_rows)
    136  1.1  ad 		return;
    137  1.1  ad 
    138  1.1  ad 	if ((unsigned)col >= (unsigned)ri->ri_cols)
    139  1.1  ad 		return;
    140  1.1  ad #endif
    141  1.1  ad 
    142  1.1  ad 	rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
    143  1.1  ad 	height = ri->ri_font->fontheight;
    144  1.1  ad 	width = ri->ri_font->fontwidth;
    145  1.1  ad 
    146  1.1  ad 	clr[1] = ri->ri_devcmap[((u_int)attr >> 24) & 15];
    147  1.1  ad 	clr[0] = ri->ri_devcmap[((u_int)attr >> 16) & 15];
    148  1.1  ad 
    149  1.3  ad 	if (uc == ' ') {
    150  1.3  ad 		while (height--) {
    151  1.3  ad 			dp = rp;
    152  1.3  ad 			rp += ri->ri_stride;
    153  1.3  ad 
    154  1.3  ad 			for (cnt = width; cnt; cnt--) {
    155  1.3  ad 				*(int16_t *)dp = (int16_t)clr[0];
    156  1.3  ad 				dp += 2;
    157  1.3  ad 			}
    158  1.3  ad 		}
    159  1.3  ad 	} else {
    160  1.3  ad 		uc -= ri->ri_font->firstchar;
    161  1.3  ad 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
    162  1.3  ad 
    163  1.3  ad 		while (height--) {
    164  1.3  ad 			dp = rp;
    165  1.3  ad 			fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) | (fr[0] << 24);
    166  1.3  ad 			fr += ri->ri_font->stride;
    167  1.3  ad 			rp += ri->ri_stride;
    168  1.1  ad 
    169  1.3  ad 			for (cnt = width; cnt; cnt--) {
    170  1.3  ad 				*(int16_t *)dp = (int16_t)clr[(fb >> 31) & 1];
    171  1.3  ad 				fb <<= 1;
    172  1.3  ad 				dp += 2;
    173  1.3  ad 			}
    174  1.3  ad 		}
    175  1.3  ad 	}
    176  1.3  ad 
    177  1.3  ad 	/* Do underline */
    178  1.3  ad 	if (attr & 1) {
    179  1.3  ad 		rp -= ri->ri_stride << 1;
    180  1.3  ad 
    181  1.3  ad 		while (width--) {
    182  1.3  ad 			*(int16_t *)rp = clr[1];
    183  1.3  ad 			rp += 2;
    184  1.1  ad 		}
    185  1.1  ad 	}
    186  1.1  ad }
    187  1.1  ad 
    188  1.1  ad 
    189  1.1  ad /*
    190  1.1  ad  * Recompute the (2x2)x1 blitting stamp.
    191  1.1  ad  */
    192  1.1  ad static void
    193  1.1  ad rasops15_makestamp(ri, attr)
    194  1.1  ad 	struct rasops_info *ri;
    195  1.1  ad 	long attr;
    196  1.1  ad {
    197  1.1  ad 	int32_t fg, bg;
    198  1.1  ad 	int i;
    199  1.1  ad 
    200  1.3  ad 	fg = ri->ri_devcmap[((u_int)attr >> 24) & 15] & 0xffff;
    201  1.3  ad 	bg = ri->ri_devcmap[((u_int)attr >> 16) & 15] & 0xffff;
    202  1.1  ad 	stamp_attr = attr;
    203  1.1  ad 
    204  1.3  ad 	for (i = 0; i < 32; i += 2) {
    205  1.1  ad #if BYTE_ORDER == LITTLE_ENDIAN
    206  1.3  ad 		stamp[i] = (i & 16 ? fg : bg);
    207  1.3  ad 		stamp[i] |= ((i & 8 ? fg : bg) << 16);
    208  1.3  ad 		stamp[i + 1] = (i & 4 ? fg : bg);
    209  1.3  ad 		stamp[i + 1] |= ((i & 2 ? fg : bg) << 16);
    210  1.1  ad #else
    211  1.3  ad 		stamp[i] = (i & 2 ? fg : bg);
    212  1.3  ad 		stamp[i] |= ((i & 4 ? fg : bg) << 16);
    213  1.3  ad 		stamp[i + 1] = (i & 8 ? fg : bg);
    214  1.3  ad 		stamp[i + 1] |= ((i & 16 ? fg : bg) << 16);
    215  1.1  ad #endif
    216  1.1  ad 	}
    217  1.1  ad }
    218  1.1  ad 
    219  1.1  ad 
    220  1.1  ad /*
    221  1.1  ad  * Paint a single character. This is for 8-pixel wide fonts.
    222  1.1  ad  */
    223  1.1  ad static void
    224  1.1  ad rasops15_putchar8(cookie, row, col, uc, attr)
    225  1.1  ad 	void *cookie;
    226  1.1  ad 	int row, col;
    227  1.1  ad 	u_int uc;
    228  1.1  ad 	long attr;
    229  1.1  ad {
    230  1.1  ad 	struct rasops_info *ri;
    231  1.1  ad 	int height, so, fs;
    232  1.1  ad 	int32_t *rp;
    233  1.1  ad 	u_char *fr;
    234  1.1  ad 
    235  1.1  ad 	/* Can't risk remaking the stamp if it's already in use */
    236  1.1  ad 	if (stamp_mutex++) {
    237  1.1  ad 		stamp_mutex--;
    238  1.1  ad 		rasops15_putchar(cookie, row, col, uc, attr);
    239  1.1  ad 		return;
    240  1.1  ad 	}
    241  1.1  ad 
    242  1.1  ad 	ri = (struct rasops_info *)cookie;
    243  1.1  ad 
    244  1.1  ad #ifdef RASOPS_CLIPPING
    245  1.1  ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    246  1.1  ad 		stamp_mutex--;
    247  1.1  ad 		return;
    248  1.1  ad 	}
    249  1.1  ad 
    250  1.1  ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    251  1.1  ad 		stamp_mutex--;
    252  1.1  ad 		return;
    253  1.1  ad 	}
    254  1.1  ad #endif
    255  1.1  ad 
    256  1.1  ad 	/* Recompute stamp? */
    257  1.1  ad 	if (attr != stamp_attr)
    258  1.1  ad 		rasops15_makestamp(ri, attr);
    259  1.1  ad 
    260  1.1  ad 	rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
    261  1.1  ad 	height = ri->ri_font->fontheight;
    262  1.1  ad 
    263  1.1  ad 	if (uc == (u_int)-1) {
    264  1.1  ad 		while (height--) {
    265  1.1  ad 			rp[0] = stamp[0];
    266  1.1  ad 			rp[1] = stamp[0];
    267  1.1  ad 			rp[2] = stamp[0];
    268  1.1  ad 			rp[3] = stamp[0];
    269  1.1  ad 			DELTA(rp, ri->ri_stride, int32_t *);
    270  1.1  ad 		}
    271  1.1  ad 	} else {
    272  1.1  ad 		uc -= ri->ri_font->firstchar;
    273  1.1  ad 		fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
    274  1.1  ad 		fs = ri->ri_font->stride;
    275  1.1  ad 
    276  1.1  ad 		while (height--) {
    277  1.1  ad 			so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
    278  1.1  ad 			rp[0] = STAMP_READ(so);
    279  1.1  ad 			rp[1] = STAMP_READ(so + 4);
    280  1.1  ad 
    281  1.1  ad 			so = STAMP_SHIFT(fr[0], 0) & STAMP_MASK;
    282  1.1  ad 			rp[2] = STAMP_READ(so);
    283  1.1  ad 			rp[3] = STAMP_READ(so + 4);
    284  1.1  ad 
    285  1.1  ad 			fr += fs;
    286  1.1  ad 			DELTA(rp, ri->ri_stride, int32_t *);
    287  1.1  ad 		}
    288  1.1  ad 	}
    289  1.3  ad 
    290  1.3  ad 	/* Do underline */
    291  1.3  ad 	if (attr & 1) {
    292  1.3  ad 		DELTA(rp, -(ri->ri_stride << 1), int32_t *);
    293  1.3  ad 		rp[0] = STAMP_READ(30);
    294  1.3  ad 		rp[1] = STAMP_READ(30);
    295  1.3  ad 		rp[2] = STAMP_READ(30);
    296  1.3  ad 		rp[3] = STAMP_READ(30);
    297  1.3  ad 	}
    298  1.1  ad 
    299  1.1  ad 	stamp_mutex--;
    300  1.1  ad }
    301  1.1  ad 
    302  1.1  ad 
    303  1.1  ad /*
    304  1.1  ad  * Paint a single character. This is for 12-pixel wide fonts.
    305  1.1  ad  */
    306  1.1  ad static void
    307  1.1  ad rasops15_putchar12(cookie, row, col, uc, attr)
    308  1.1  ad 	void *cookie;
    309  1.1  ad 	int row, col;
    310  1.1  ad 	u_int uc;
    311  1.1  ad 	long attr;
    312  1.1  ad {
    313  1.1  ad 	struct rasops_info *ri;
    314  1.1  ad 	int height, so, fs;
    315  1.1  ad 	int32_t *rp;
    316  1.1  ad 	u_char *fr;
    317  1.1  ad 
    318  1.1  ad 	/* Can't risk remaking the stamp if it's already in use */
    319  1.1  ad 	if (stamp_mutex++) {
    320  1.1  ad 		stamp_mutex--;
    321  1.1  ad 		rasops15_putchar(cookie, row, col, uc, attr);
    322  1.1  ad 		return;
    323  1.1  ad 	}
    324  1.1  ad 
    325  1.1  ad 	ri = (struct rasops_info *)cookie;
    326  1.1  ad 
    327  1.1  ad #ifdef RASOPS_CLIPPING
    328  1.1  ad 	if ((unsigned)row >= (unsigned)ri->ri_rows) {
    329  1.1  ad 		stamp_mutex--;
    330  1.1  ad 		return;
    331  1.1  ad 	}
    332  1.1  ad 
    333  1.1  ad 	if ((unsigned)col >= (unsigned)ri->ri_cols) {
    334  1.1  ad 		stamp_mutex--;
    335  1.1  ad 		return;
    336  1.1  ad 	}
    337  1.1  ad #endif
    338  1.1  ad 
    339  1.1  ad 	/* Recompute stamp? */
    340  1.1  ad 	if (attr != stamp_attr)
    341  1.1  ad 		rasops15_makestamp(ri, attr);
    342  1.1  ad 
    343  1.1  ad 	rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
    344  1.1  ad 	height = ri->ri_font->fontheight;
    345  1.1  ad 
    346  1.1  ad 	if (uc == (u_int)-1) {
    347  1.1  ad 		while (height--) {
    348  1.1  ad 			rp[0] = stamp[0];
    349  1.1  ad 			rp[1] = stamp[0];
    350  1.1  ad 			rp[2] = stamp[0];
    351  1.1  ad 			rp[3] = stamp[0];
    352  1.1  ad 			rp[4] = stamp[0];
    353  1.1  ad 			rp[5] = stamp[0];
    354  1.1  ad 			DELTA(rp, ri->ri_stride, int32_t *);
    355  1.1  ad 		}
    356  1.1  ad 	} else {
    357  1.1  ad 		uc -= ri->ri_font->firstchar;
    358  1.1  ad 		fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
    359  1.1  ad 		fs = ri->ri_font->stride;
    360  1.1  ad 
    361  1.1  ad 		while (height--) {
    362  1.1  ad 			so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
    363  1.1  ad 			rp[0] = STAMP_READ(so);
    364  1.1  ad 			rp[1] = STAMP_READ(so + 4);
    365  1.1  ad 
    366  1.1  ad 			so = STAMP_SHIFT(fr[0], 0) & STAMP_MASK;
    367  1.1  ad 			rp[2] = STAMP_READ(so);
    368  1.1  ad 			rp[3] = STAMP_READ(so + 4);
    369  1.1  ad 
    370  1.1  ad 			so = STAMP_SHIFT(fr[1], 1) & STAMP_MASK;
    371  1.1  ad 			rp[4] = STAMP_READ(so);
    372  1.1  ad 			rp[5] = STAMP_READ(so + 4);
    373  1.1  ad 
    374  1.1  ad 			fr += fs;
    375  1.1  ad 			DELTA(rp, ri->ri_stride, int32_t *);
    376  1.1  ad 		}
    377  1.1  ad 	}
    378  1.3  ad 
    379  1.3  ad 	/* Do underline */
    380  1.3  ad 	if (attr & 1) {
    381  1.3  ad 		DELTA(rp, -(ri->ri_stride << 1), int32_t *);
    382  1.3  ad 		rp[0] = STAMP_READ(30);
    383  1.3  ad 		rp[1] = STAMP_READ(30);
    384  1.3  ad 		rp[2] = STAMP_READ(30);
    385  1.3  ad 		rp[3] = STAMP_READ(30);
    386  1.3  ad 		rp[4] = STAMP_READ(30);
    387  1.3  ad 		rp[5] = STAMP_READ(30);
    388  1.3  ad 	}
    389  1.1  ad 
    390  1.1  ad 	stamp_mutex--;
    391  1.1  ad }
    392  1.1  ad 
    393  1.1  ad 
    394  1.1  ad /*
    395  1.1  ad  * Paint a single character. This is for 16-pixel wide fonts.
    396  1.1  ad  */
    397  1.1  ad static void
    398  1.1  ad rasops15_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, so, fs;
    406  1.1  ad 	int32_t *rp;
    407  1.1  ad 	u_char *fr;
    408  1.1  ad 
    409  1.1  ad 	/* Can't risk remaking the stamp if it's already in use */
    410  1.1  ad 	if (stamp_mutex++) {
    411  1.1  ad 		stamp_mutex--;
    412  1.1  ad 		rasops15_putchar(cookie, row, col, uc, attr);
    413  1.1  ad 		return;
    414  1.1  ad 	}
    415  1.1  ad 
    416  1.1  ad 	ri = (struct rasops_info *)cookie;
    417  1.1  ad 
    418  1.1  ad #ifdef RASOPS_CLIPPING
    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 	/* Recompute stamp? */
    431  1.1  ad 	if (attr != stamp_attr)
    432  1.1  ad 		rasops15_makestamp(ri, attr);
    433  1.1  ad 
    434  1.1  ad 	rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
    435  1.1  ad 	height = ri->ri_font->fontheight;
    436  1.1  ad 
    437  1.1  ad 	if (uc == (u_int)-1) {
    438  1.1  ad 		while (height--) {
    439  1.1  ad 			rp[0] = stamp[0];
    440  1.1  ad 			rp[1] = stamp[0];
    441  1.1  ad 			rp[2] = stamp[0];
    442  1.1  ad 			rp[3] = stamp[0];
    443  1.1  ad 			rp[4] = stamp[0];
    444  1.1  ad 			rp[5] = stamp[0];
    445  1.1  ad 			rp[6] = stamp[0];
    446  1.1  ad 			rp[7] = stamp[0];
    447  1.1  ad 			DELTA(rp, ri->ri_stride, int32_t *);
    448  1.1  ad 		}
    449  1.1  ad 	} else {
    450  1.1  ad 		uc -= ri->ri_font->firstchar;
    451  1.1  ad 		fr = (u_char *)ri->ri_font->data + uc*ri->ri_fontscale;
    452  1.1  ad 		fs = ri->ri_font->stride;
    453  1.1  ad 
    454  1.1  ad 		while (height--) {
    455  1.1  ad 			so = STAMP_SHIFT(fr[0], 1) & STAMP_MASK;
    456  1.1  ad 			rp[0] = STAMP_READ(so);
    457  1.1  ad 			rp[1] = STAMP_READ(so + 4);
    458  1.1  ad 
    459  1.1  ad 			so = STAMP_SHIFT(fr[0], 0) & STAMP_MASK;
    460  1.1  ad 			rp[2] = STAMP_READ(so);
    461  1.1  ad 			rp[3] = STAMP_READ(so + 4);
    462  1.1  ad 
    463  1.1  ad 			so = STAMP_SHIFT(fr[1], 1) & STAMP_MASK;
    464  1.1  ad 			rp[4] = STAMP_READ(so);
    465  1.1  ad 			rp[5] = STAMP_READ(so + 4);
    466  1.1  ad 
    467  1.1  ad 			so = STAMP_SHIFT(fr[1], 0) & STAMP_MASK;
    468  1.1  ad 			rp[6] = STAMP_READ(so);
    469  1.1  ad 			rp[7] = STAMP_READ(so + 4);
    470  1.1  ad 
    471  1.1  ad 			DELTA(rp, ri->ri_stride, int32_t *);
    472  1.1  ad 			fr += fs;
    473  1.1  ad 		}
    474  1.1  ad 	}
    475  1.3  ad 
    476  1.3  ad 	/* Do underline */
    477  1.3  ad 	if (attr & 1) {
    478  1.3  ad 		DELTA(rp, -(ri->ri_stride << 1), int32_t *);
    479  1.3  ad 		rp[0] = STAMP_READ(30);
    480  1.3  ad 		rp[1] = STAMP_READ(30);
    481  1.3  ad 		rp[2] = STAMP_READ(30);
    482  1.3  ad 		rp[3] = STAMP_READ(30);
    483  1.3  ad 		rp[4] = STAMP_READ(30);
    484  1.3  ad 		rp[5] = STAMP_READ(30);
    485  1.3  ad 		rp[6] = STAMP_READ(30);
    486  1.3  ad 		rp[7] = STAMP_READ(30);
    487  1.3  ad 	}
    488  1.1  ad 
    489  1.1  ad 	stamp_mutex--;
    490  1.1  ad }
    491