use CHAR_IN_FONT() and WSFONT_GLYPH() macros

This commit is contained in:
macallan 2012-01-04 17:01:52 +00:00
parent 2c13773a38
commit 1e50f31f65
2 changed files with 14 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops32.c,v 1.23 2012/01/03 23:15:11 macallan Exp $ */
/* $NetBSD: rasops32.c,v 1.24 2012/01/04 17:01:52 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.23 2012/01/03 23:15:11 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.24 2012/01/04 17:01:52 macallan Exp $");
#include "opt_rasops.h"
@ -92,9 +92,8 @@ rasops32_putchar(void *cookie, int row, int col, u_int uc, long attr)
#endif
/* check if character fits into font limits */
if (uc < font->firstchar ||
(uc - font->firstchar) >= font->numchars)
return;
if (!CHAR_IN_FONT(uc, font))
return;
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
if (ri->ri_hwbits)
@ -123,8 +122,7 @@ rasops32_putchar(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fr = WSFONT_GLYPH(uc, font);
fs = font->stride;
while (height--) {
@ -184,9 +182,8 @@ rasops32_putchar_aa(void *cookie, int row, int col, u_int uc, long attr)
#endif
/* check if character fits into font limits */
if (uc < font->firstchar ||
(uc - font->firstchar) >= font->numchars)
return;
if (!CHAR_IN_FONT(uc, font))
return;
rp = (int32_t *)(ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
if (ri->ri_hwbits)
@ -215,8 +212,7 @@ rasops32_putchar_aa(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fr = WSFONT_GLYPH(uc, font);
fs = font->stride;
r0 = (clr[0] >> 16) & 0xff;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rasops8.c,v 1.28 2011/12/28 08:36:46 macallan Exp $ */
/* $NetBSD: rasops8.c,v 1.29 2012/01/04 17:01:52 macallan Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.28 2011/12/28 08:36:46 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.29 2012/01/04 17:01:52 macallan Exp $");
#include "opt_rasops.h"
@ -153,8 +153,7 @@ rasops8_putchar(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fr = WSFONT_GLYPH(uc, font);
fs = font->stride;
while (height--) {
@ -285,8 +284,7 @@ rasops8_putchar8(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fr = WSFONT_GLYPH(uc, font);
fs = font->stride;
while (height--) {
@ -380,8 +378,7 @@ rasops8_putchar12(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fr = WSFONT_GLYPH(uc, font);
fs = font->stride;
while (height--) {
@ -474,8 +471,7 @@ rasops8_putchar16(void *cookie, int row, int col, u_int uc, long attr)
}
}
} else {
uc -= font->firstchar;
fr = (u_char *)font->data + uc * ri->ri_fontscale;
fr = WSFONT_GLYPH(uc, font);
fs = font->stride;
while (height--) {