summaryrefslogtreecommitdiff
path: root/sys/dev/rasops
diff options
context:
space:
mode:
authormacallan <macallan@NetBSD.org>2012-01-04 17:01:52 +0000
committermacallan <macallan@NetBSD.org>2012-01-04 17:01:52 +0000
commit1d05d2d41e8d08b2efa473beaf4431da431703e2 (patch)
tree9d141edd8108ce78e8a35350f995db06f3715117 /sys/dev/rasops
parente53cb5f014c068a214bd9d5337e451c1035265ea (diff)
use CHAR_IN_FONT() and WSFONT_GLYPH() macros
Diffstat (limited to 'sys/dev/rasops')
-rw-r--r--sys/dev/rasops/rasops32.c20
-rw-r--r--sys/dev/rasops/rasops8.c16
2 files changed, 14 insertions, 22 deletions
diff --git a/sys/dev/rasops/rasops32.c b/sys/dev/rasops/rasops32.c
index dde50743d2b..6e1ed10d3f5 100644
--- a/sys/dev/rasops/rasops32.c
+++ b/sys/dev/rasops/rasops32.c
@@ -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;
diff --git a/sys/dev/rasops/rasops8.c b/sys/dev/rasops/rasops8.c
index 7c5f3c7c308..9a567c5f3ac 100644
--- a/sys/dev/rasops/rasops8.c
+++ b/sys/dev/rasops/rasops8.c
@@ -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--) {