rasops8.c revision 1.26 1 1.26 dsl /* $NetBSD: rasops8.c,v 1.26 2009/03/14 21:04:22 dsl 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.9 ad * by Andrew 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.1 ad *
19 1.4 ad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 1.4 ad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 1.4 ad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 1.4 ad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 1.4 ad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 1.4 ad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 1.4 ad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 1.4 ad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 1.4 ad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 1.4 ad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 1.4 ad * POSSIBILITY OF SUCH DAMAGE.
30 1.1 ad */
31 1.2 ad
32 1.12 lukem #include <sys/cdefs.h>
33 1.26 dsl __KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.26 2009/03/14 21:04:22 dsl Exp $");
34 1.12 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
41 1.1 ad #include <dev/wscons/wsdisplayvar.h>
42 1.1 ad #include <dev/wscons/wsconsio.h>
43 1.1 ad #include <dev/rasops/rasops.h>
44 1.1 ad
45 1.18 perry static void rasops8_putchar(void *, int, int, u_int, long attr);
46 1.7 ad #ifndef RASOPS_SMALL
47 1.18 perry static void rasops8_putchar8(void *, int, int, u_int, long attr);
48 1.18 perry static void rasops8_putchar12(void *, int, int, u_int, long attr);
49 1.18 perry static void rasops8_putchar16(void *, int, int, u_int, long attr);
50 1.18 perry static void rasops8_makestamp(struct rasops_info *ri, long);
51 1.1 ad
52 1.8 pk /*
53 1.8 pk * 4x1 stamp for optimized character blitting
54 1.1 ad */
55 1.1 ad static int32_t stamp[16];
56 1.1 ad static long stamp_attr;
57 1.1 ad static int stamp_mutex; /* XXX see note in README */
58 1.10 bjh21 #endif
59 1.1 ad
60 1.1 ad /*
61 1.1 ad * XXX this confuses the hell out of gcc2 (not egcs) which always insists
62 1.1 ad * that the shift count is negative.
63 1.1 ad *
64 1.1 ad * offset = STAMP_SHIFT(fontbits, nibble #) & STAMP_MASK
65 1.1 ad * destination = STAMP_READ(offset)
66 1.1 ad */
67 1.1 ad #define STAMP_SHIFT(fb,n) ((n*4-2) >= 0 ? (fb)>>(n*4-2):(fb)<<-(n*4-2))
68 1.8 pk #define STAMP_MASK (0xf << 2)
69 1.22 christos #define STAMP_READ(o) (*(int32_t *)((char *)stamp + (o)))
70 1.1 ad
71 1.1 ad /*
72 1.11 wiz * Initialize a 'rasops_info' descriptor for this depth.
73 1.1 ad */
74 1.1 ad void
75 1.25 dsl rasops8_init(struct rasops_info *ri)
76 1.1 ad {
77 1.8 pk
78 1.1 ad switch (ri->ri_font->fontwidth) {
79 1.7 ad #ifndef RASOPS_SMALL
80 1.1 ad case 8:
81 1.1 ad ri->ri_ops.putchar = rasops8_putchar8;
82 1.1 ad break;
83 1.1 ad case 12:
84 1.1 ad ri->ri_ops.putchar = rasops8_putchar12;
85 1.1 ad break;
86 1.1 ad case 16:
87 1.1 ad ri->ri_ops.putchar = rasops8_putchar16;
88 1.1 ad break;
89 1.7 ad #endif /* !RASOPS_SMALL */
90 1.1 ad default:
91 1.1 ad ri->ri_ops.putchar = rasops8_putchar;
92 1.1 ad break;
93 1.1 ad }
94 1.1 ad }
95 1.1 ad
96 1.1 ad /*
97 1.3 ad * Put a single character.
98 1.1 ad */
99 1.1 ad static void
100 1.26 dsl rasops8_putchar(void *cookie, int row, int col, u_int uc, long attr)
101 1.1 ad {
102 1.7 ad int width, height, cnt, fs, fb;
103 1.21 jmcneill u_char *dp, *rp, *hp, *hrp, *fr, clr[2];
104 1.1 ad struct rasops_info *ri;
105 1.8 pk
106 1.1 ad ri = (struct rasops_info *)cookie;
107 1.21 jmcneill hp = hrp = NULL;
108 1.1 ad
109 1.17 petrov if (!CHAR_IN_FONT(uc, ri->ri_font))
110 1.17 petrov return;
111 1.17 petrov
112 1.8 pk #ifdef RASOPS_CLIPPING
113 1.8 pk /* Catches 'row < 0' case too */
114 1.1 ad if ((unsigned)row >= (unsigned)ri->ri_rows)
115 1.1 ad return;
116 1.1 ad
117 1.1 ad if ((unsigned)col >= (unsigned)ri->ri_cols)
118 1.1 ad return;
119 1.1 ad #endif
120 1.1 ad rp = ri->ri_bits + row * ri->ri_yscale + col * ri->ri_xscale;
121 1.21 jmcneill if (ri->ri_hwbits)
122 1.21 jmcneill hrp = ri->ri_hwbits + row * ri->ri_yscale + col *
123 1.21 jmcneill ri->ri_xscale;
124 1.1 ad
125 1.1 ad height = ri->ri_font->fontheight;
126 1.1 ad width = ri->ri_font->fontwidth;
127 1.8 pk clr[0] = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
128 1.8 pk clr[1] = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
129 1.8 pk
130 1.1 ad if (uc == ' ') {
131 1.8 pk u_char c = clr[0];
132 1.8 pk
133 1.1 ad while (height--) {
134 1.1 ad dp = rp;
135 1.1 ad rp += ri->ri_stride;
136 1.21 jmcneill if (ri->ri_hwbits) {
137 1.21 jmcneill hp = hrp;
138 1.21 jmcneill hrp += ri->ri_stride;
139 1.21 jmcneill }
140 1.8 pk
141 1.21 jmcneill for (cnt = width; cnt; cnt--) {
142 1.8 pk *dp++ = c;
143 1.21 jmcneill if (ri->ri_hwbits)
144 1.21 jmcneill *hp++ = c;
145 1.21 jmcneill }
146 1.1 ad }
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 while (height--) {
153 1.1 ad dp = rp;
154 1.21 jmcneill if (ri->ri_hwbits)
155 1.21 jmcneill hp = hrp;
156 1.1 ad fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) | (fr[0] << 24);
157 1.1 ad fr += fs;
158 1.1 ad rp += ri->ri_stride;
159 1.21 jmcneill if (ri->ri_hwbits)
160 1.21 jmcneill hrp += ri->ri_stride;
161 1.8 pk
162 1.1 ad for (cnt = width; cnt; cnt--) {
163 1.1 ad *dp++ = clr[(fb >> 31) & 1];
164 1.21 jmcneill if (ri->ri_hwbits)
165 1.21 jmcneill *hp++ = clr[(fb >> 31) & 1];
166 1.1 ad fb <<= 1;
167 1.1 ad }
168 1.1 ad }
169 1.8 pk }
170 1.1 ad
171 1.1 ad /* Do underline */
172 1.7 ad if ((attr & 1) != 0) {
173 1.8 pk u_char c = clr[1];
174 1.8 pk
175 1.1 ad rp -= (ri->ri_stride << 1);
176 1.21 jmcneill if (ri->ri_hwbits)
177 1.21 jmcneill hrp -= (ri->ri_stride << 1);
178 1.1 ad
179 1.21 jmcneill while (width--) {
180 1.8 pk *rp++ = c;
181 1.21 jmcneill if (ri->ri_hwbits)
182 1.21 jmcneill *hrp++ = c;
183 1.21 jmcneill }
184 1.8 pk }
185 1.1 ad }
186 1.1 ad
187 1.7 ad #ifndef RASOPS_SMALL
188 1.1 ad /*
189 1.1 ad * Recompute the 4x1 blitting stamp.
190 1.1 ad */
191 1.1 ad static void
192 1.25 dsl rasops8_makestamp(struct rasops_info *ri, long attr)
193 1.1 ad {
194 1.7 ad int32_t fg, bg;
195 1.1 ad int i;
196 1.5 ad
197 1.8 pk fg = ri->ri_devcmap[(attr >> 24) & 0xf] & 0xff;
198 1.8 pk bg = ri->ri_devcmap[(attr >> 16) & 0xf] & 0xff;
199 1.1 ad stamp_attr = attr;
200 1.8 pk
201 1.1 ad for (i = 0; i < 16; i++) {
202 1.16 uwe #if BYTE_ORDER == BIG_ENDIAN
203 1.16 uwe #define NEED_LITTLE_ENDIAN_STAMP RI_BSWAP
204 1.1 ad #else
205 1.16 uwe #define NEED_LITTLE_ENDIAN_STAMP 0
206 1.1 ad #endif
207 1.16 uwe if ((ri->ri_flg & RI_BSWAP) == NEED_LITTLE_ENDIAN_STAMP) {
208 1.16 uwe /* little endian */
209 1.16 uwe stamp[i] = (i & 8 ? fg : bg);
210 1.16 uwe stamp[i] |= ((i & 4 ? fg : bg) << 8);
211 1.16 uwe stamp[i] |= ((i & 2 ? fg : bg) << 16);
212 1.16 uwe stamp[i] |= ((i & 1 ? fg : bg) << 24);
213 1.16 uwe } else {
214 1.16 uwe /* big endian */
215 1.16 uwe stamp[i] = (i & 1 ? fg : bg);
216 1.16 uwe stamp[i] |= ((i & 2 ? fg : bg) << 8);
217 1.16 uwe stamp[i] |= ((i & 4 ? fg : bg) << 16);
218 1.16 uwe stamp[i] |= ((i & 8 ? fg : bg) << 24);
219 1.16 uwe }
220 1.1 ad }
221 1.1 ad }
222 1.1 ad
223 1.1 ad /*
224 1.3 ad * Put a single character. This is for 8-pixel wide fonts.
225 1.1 ad */
226 1.1 ad static void
227 1.26 dsl rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
228 1.1 ad {
229 1.1 ad struct rasops_info *ri;
230 1.1 ad int height, fs;
231 1.21 jmcneill int32_t *rp, *hp;
232 1.1 ad u_char *fr;
233 1.8 pk
234 1.1 ad /* Can't risk remaking the stamp if it's already in use */
235 1.1 ad if (stamp_mutex++) {
236 1.1 ad stamp_mutex--;
237 1.1 ad rasops8_putchar(cookie, row, col, uc, attr);
238 1.1 ad return;
239 1.1 ad }
240 1.1 ad
241 1.1 ad ri = (struct rasops_info *)cookie;
242 1.21 jmcneill hp = NULL;
243 1.1 ad
244 1.17 petrov if (!CHAR_IN_FONT(uc, ri->ri_font))
245 1.17 petrov return;
246 1.17 petrov
247 1.8 pk #ifdef RASOPS_CLIPPING
248 1.1 ad if ((unsigned)row >= (unsigned)ri->ri_rows) {
249 1.1 ad stamp_mutex--;
250 1.1 ad return;
251 1.1 ad }
252 1.1 ad
253 1.1 ad if ((unsigned)col >= (unsigned)ri->ri_cols) {
254 1.1 ad stamp_mutex--;
255 1.1 ad return;
256 1.1 ad }
257 1.1 ad #endif
258 1.1 ad
259 1.1 ad /* Recompute stamp? */
260 1.1 ad if (attr != stamp_attr)
261 1.6 ad rasops8_makestamp(ri, attr);
262 1.8 pk
263 1.1 ad rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
264 1.21 jmcneill if (ri->ri_hwbits)
265 1.21 jmcneill hp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
266 1.21 jmcneill col*ri->ri_xscale);
267 1.1 ad height = ri->ri_font->fontheight;
268 1.8 pk
269 1.1 ad if (uc == ' ') {
270 1.1 ad while (height--) {
271 1.8 pk rp[0] = rp[1] = stamp[0];
272 1.1 ad DELTA(rp, ri->ri_stride, int32_t *);
273 1.21 jmcneill if (ri->ri_hwbits) {
274 1.23 jmcneill hp[0] = stamp[0];
275 1.23 jmcneill hp[1] = stamp[0];
276 1.21 jmcneill DELTA(hp, ri->ri_stride, int32_t *);
277 1.21 jmcneill }
278 1.8 pk }
279 1.1 ad } else {
280 1.1 ad uc -= ri->ri_font->firstchar;
281 1.1 ad fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
282 1.1 ad fs = ri->ri_font->stride;
283 1.8 pk
284 1.1 ad while (height--) {
285 1.1 ad rp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
286 1.1 ad rp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
287 1.21 jmcneill if (ri->ri_hwbits) {
288 1.21 jmcneill hp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) &
289 1.21 jmcneill STAMP_MASK);
290 1.21 jmcneill hp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) &
291 1.21 jmcneill STAMP_MASK);
292 1.21 jmcneill }
293 1.1 ad
294 1.1 ad fr += fs;
295 1.8 pk DELTA(rp, ri->ri_stride, int32_t *);
296 1.21 jmcneill if (ri->ri_hwbits)
297 1.21 jmcneill DELTA(hp, ri->ri_stride, int32_t *);
298 1.1 ad }
299 1.1 ad }
300 1.1 ad
301 1.1 ad /* Do underline */
302 1.7 ad if ((attr & 1) != 0) {
303 1.8 pk DELTA(rp, -(ri->ri_stride << 1), int32_t *);
304 1.8 pk rp[0] = rp[1] = stamp[15];
305 1.21 jmcneill if (ri->ri_hwbits) {
306 1.21 jmcneill DELTA(hp, -(ri->ri_stride << 1), int32_t *);
307 1.23 jmcneill hp[0] = stamp[15];
308 1.23 jmcneill hp[1] = stamp[15];
309 1.21 jmcneill }
310 1.8 pk }
311 1.8 pk
312 1.8 pk stamp_mutex--;
313 1.1 ad }
314 1.1 ad
315 1.1 ad /*
316 1.3 ad * Put a single character. This is for 12-pixel wide fonts.
317 1.1 ad */
318 1.1 ad static void
319 1.26 dsl rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
320 1.1 ad {
321 1.1 ad struct rasops_info *ri;
322 1.1 ad int height, fs;
323 1.21 jmcneill int32_t *rp, *hrp;
324 1.1 ad u_char *fr;
325 1.8 pk
326 1.1 ad /* Can't risk remaking the stamp if it's already in use */
327 1.1 ad if (stamp_mutex++) {
328 1.1 ad stamp_mutex--;
329 1.1 ad rasops8_putchar(cookie, row, col, uc, attr);
330 1.1 ad return;
331 1.1 ad }
332 1.1 ad
333 1.1 ad ri = (struct rasops_info *)cookie;
334 1.21 jmcneill hrp = NULL;
335 1.1 ad
336 1.17 petrov if (!CHAR_IN_FONT(uc, ri->ri_font))
337 1.17 petrov return;
338 1.17 petrov
339 1.8 pk #ifdef RASOPS_CLIPPING
340 1.1 ad if ((unsigned)row >= (unsigned)ri->ri_rows) {
341 1.1 ad stamp_mutex--;
342 1.1 ad return;
343 1.1 ad }
344 1.1 ad
345 1.1 ad if ((unsigned)col >= (unsigned)ri->ri_cols) {
346 1.1 ad stamp_mutex--;
347 1.1 ad return;
348 1.1 ad }
349 1.1 ad #endif
350 1.1 ad
351 1.1 ad /* Recompute stamp? */
352 1.1 ad if (attr != stamp_attr)
353 1.6 ad rasops8_makestamp(ri, attr);
354 1.8 pk
355 1.1 ad rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
356 1.21 jmcneill if (ri->ri_hwbits)
357 1.21 jmcneill hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
358 1.21 jmcneill col*ri->ri_xscale);
359 1.1 ad height = ri->ri_font->fontheight;
360 1.8 pk
361 1.1 ad if (uc == ' ') {
362 1.1 ad while (height--) {
363 1.8 pk int32_t c = stamp[0];
364 1.8 pk
365 1.8 pk rp[0] = rp[1] = rp[2] = c;
366 1.8 pk DELTA(rp, ri->ri_stride, int32_t *);
367 1.21 jmcneill if (ri->ri_hwbits) {
368 1.23 jmcneill hrp[0] = c;
369 1.23 jmcneill hrp[1] = c;
370 1.23 jmcneill hrp[2] = c;
371 1.21 jmcneill DELTA(hrp, ri->ri_stride, int32_t *);
372 1.21 jmcneill }
373 1.8 pk }
374 1.1 ad } else {
375 1.1 ad uc -= ri->ri_font->firstchar;
376 1.1 ad fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
377 1.1 ad fs = ri->ri_font->stride;
378 1.8 pk
379 1.1 ad while (height--) {
380 1.1 ad rp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
381 1.1 ad rp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
382 1.1 ad rp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
383 1.21 jmcneill if (ri->ri_hwbits) {
384 1.21 jmcneill hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
385 1.21 jmcneill hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
386 1.21 jmcneill hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
387 1.21 jmcneill }
388 1.8 pk
389 1.1 ad fr += fs;
390 1.8 pk DELTA(rp, ri->ri_stride, int32_t *);
391 1.21 jmcneill if (ri->ri_hwbits)
392 1.21 jmcneill DELTA(hrp, ri->ri_stride, int32_t *);
393 1.1 ad }
394 1.8 pk }
395 1.1 ad
396 1.1 ad /* Do underline */
397 1.7 ad if ((attr & 1) != 0) {
398 1.8 pk DELTA(rp, -(ri->ri_stride << 1), int32_t *);
399 1.8 pk rp[0] = rp[1] = rp[2] = stamp[15];
400 1.21 jmcneill if (ri->ri_hwbits) {
401 1.21 jmcneill DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
402 1.23 jmcneill hrp[0] = stamp[15];
403 1.23 jmcneill hrp[1] = stamp[15];
404 1.23 jmcneill hrp[2] = stamp[15];
405 1.21 jmcneill }
406 1.8 pk }
407 1.8 pk
408 1.1 ad stamp_mutex--;
409 1.1 ad }
410 1.1 ad
411 1.1 ad /*
412 1.3 ad * Put a single character. This is for 16-pixel wide fonts.
413 1.1 ad */
414 1.1 ad static void
415 1.26 dsl rasops8_putchar16(void *cookie, int row, int col, u_int uc, long attr)
416 1.1 ad {
417 1.1 ad struct rasops_info *ri;
418 1.1 ad int height, fs;
419 1.21 jmcneill int32_t *rp, *hrp;
420 1.1 ad u_char *fr;
421 1.1 ad
422 1.1 ad /* Can't risk remaking the stamp if it's already in use */
423 1.1 ad if (stamp_mutex++) {
424 1.1 ad stamp_mutex--;
425 1.1 ad rasops8_putchar(cookie, row, col, uc, attr);
426 1.1 ad return;
427 1.1 ad }
428 1.1 ad
429 1.1 ad ri = (struct rasops_info *)cookie;
430 1.21 jmcneill hrp = NULL;
431 1.1 ad
432 1.17 petrov if (!CHAR_IN_FONT(uc, ri->ri_font))
433 1.17 petrov return;
434 1.17 petrov
435 1.8 pk #ifdef RASOPS_CLIPPING
436 1.1 ad if ((unsigned)row >= (unsigned)ri->ri_rows) {
437 1.1 ad stamp_mutex--;
438 1.1 ad return;
439 1.1 ad }
440 1.1 ad
441 1.1 ad if ((unsigned)col >= (unsigned)ri->ri_cols) {
442 1.1 ad stamp_mutex--;
443 1.1 ad return;
444 1.1 ad }
445 1.1 ad #endif
446 1.1 ad
447 1.1 ad /* Recompute stamp? */
448 1.1 ad if (attr != stamp_attr)
449 1.6 ad rasops8_makestamp(ri, attr);
450 1.8 pk
451 1.1 ad rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
452 1.21 jmcneill if (ri->ri_hwbits)
453 1.21 jmcneill hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
454 1.21 jmcneill col*ri->ri_xscale);
455 1.21 jmcneill
456 1.1 ad height = ri->ri_font->fontheight;
457 1.8 pk
458 1.1 ad if (uc == ' ') {
459 1.21 jmcneill while (height--) {
460 1.8 pk rp[0] = rp[1] = rp[2] = rp[3] = stamp[0];
461 1.23 jmcneill if (ri->ri_hwbits) {
462 1.23 jmcneill hrp[0] = stamp[0];
463 1.23 jmcneill hrp[1] = stamp[0];
464 1.23 jmcneill hrp[2] = stamp[0];
465 1.23 jmcneill hrp[3] = stamp[0];
466 1.23 jmcneill }
467 1.21 jmcneill }
468 1.1 ad } else {
469 1.1 ad uc -= ri->ri_font->firstchar;
470 1.1 ad fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
471 1.1 ad fs = ri->ri_font->stride;
472 1.8 pk
473 1.1 ad while (height--) {
474 1.1 ad rp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
475 1.1 ad rp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
476 1.1 ad rp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
477 1.1 ad rp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) & STAMP_MASK);
478 1.21 jmcneill if (ri->ri_hwbits) {
479 1.21 jmcneill hrp[0] = STAMP_READ(STAMP_SHIFT(fr[0], 1) & STAMP_MASK);
480 1.21 jmcneill hrp[1] = STAMP_READ(STAMP_SHIFT(fr[0], 0) & STAMP_MASK);
481 1.21 jmcneill hrp[2] = STAMP_READ(STAMP_SHIFT(fr[1], 1) & STAMP_MASK);
482 1.21 jmcneill hrp[3] = STAMP_READ(STAMP_SHIFT(fr[1], 0) & STAMP_MASK);
483 1.21 jmcneill }
484 1.1 ad
485 1.1 ad fr += fs;
486 1.8 pk DELTA(rp, ri->ri_stride, int32_t *);
487 1.21 jmcneill if (ri->ri_hwbits)
488 1.21 jmcneill DELTA(hrp, ri->ri_stride, int32_t *);
489 1.1 ad }
490 1.8 pk }
491 1.1 ad
492 1.1 ad /* Do underline */
493 1.7 ad if ((attr & 1) != 0) {
494 1.8 pk DELTA(rp, -(ri->ri_stride << 1), int32_t *);
495 1.8 pk rp[0] = rp[1] = rp[2] = rp[3] = stamp[15];
496 1.21 jmcneill if (ri->ri_hwbits) {
497 1.21 jmcneill DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
498 1.23 jmcneill hrp[0] = stamp[15];
499 1.23 jmcneill hrp[1] = stamp[15];
500 1.23 jmcneill hrp[2] = stamp[15];
501 1.23 jmcneill hrp[3] = stamp[15];
502 1.21 jmcneill }
503 1.8 pk }
504 1.8 pk
505 1.1 ad stamp_mutex--;
506 1.1 ad }
507 1.7 ad #endif /* !RASOPS_SMALL */
508