Module Name: src
Committed By: macallan
Date: Wed Jan 4 17:01:52 UTC 2012
Modified Files:
src/sys/dev/rasops: rasops32.c rasops8.c
Log Message:
use CHAR_IN_FONT() and WSFONT_GLYPH() macros
To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/rasops/rasops8.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/rasops/rasops32.c
diff -u src/sys/dev/rasops/rasops32.c:1.23 src/sys/dev/rasops/rasops32.c:1.24
--- src/sys/dev/rasops/rasops32.c:1.23 Tue Jan 3 23:15:11 2012
+++ src/sys/dev/rasops/rasops32.c Wed Jan 4 17:01:52 2012
@@ -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,
#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,
}
}
} 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 ro
#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 ro
}
}
} 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;
Index: src/sys/dev/rasops/rasops8.c
diff -u src/sys/dev/rasops/rasops8.c:1.28 src/sys/dev/rasops/rasops8.c:1.29
--- src/sys/dev/rasops/rasops8.c:1.28 Wed Dec 28 08:36:46 2011
+++ src/sys/dev/rasops/rasops8.c Wed Jan 4 17:01:52 2012
@@ -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, i
}
}
} 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,
}
}
} 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,
}
}
} 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,
}
}
} else {
- uc -= font->firstchar;
- fr = (u_char *)font->data + uc * ri->ri_fontscale;
+ fr = WSFONT_GLYPH(uc, font);
fs = font->stride;
while (height--) {