Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/rasops use CHAR_IN_FONT() and WSFONT_GLYPH() macros



details:   https://anonhg.NetBSD.org/src/rev/f393295d32a5
branches:  trunk
changeset: 772467:f393295d32a5
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Jan 04 17:01:52 2012 +0000

description:
use CHAR_IN_FONT() and WSFONT_GLYPH() macros

diffstat:

 sys/dev/rasops/rasops32.c |  20 ++++++++------------
 sys/dev/rasops/rasops8.c  |  16 ++++++----------
 2 files changed, 14 insertions(+), 22 deletions(-)

diffs (120 lines):

diff -r 1db49fb6b8a3 -r f393295d32a5 sys/dev/rasops/rasops32.c
--- a/sys/dev/rasops/rasops32.c Wed Jan 04 16:37:45 2012 +0000
+++ b/sys/dev/rasops/rasops32.c Wed Jan 04 17:01:52 2012 +0000
@@ -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 @@
 #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 @@
                        }
                }
        } 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 @@
 #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 @@
                        }
                }
        } 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 -r 1db49fb6b8a3 -r f393295d32a5 sys/dev/rasops/rasops8.c
--- a/sys/dev/rasops/rasops8.c  Wed Jan 04 16:37:45 2012 +0000
+++ b/sys/dev/rasops/rasops8.c  Wed Jan 04 17:01:52 2012 +0000
@@ -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 @@
                        }
                }
        } 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 @@
                        }
                }
        } 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 @@
                        }
                }
        } 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 @@
                        }
                }
        } else {
-               uc -= font->firstchar;
-               fr = (u_char *)font->data + uc * ri->ri_fontscale;
+               fr = WSFONT_GLYPH(uc, font);
                fs = font->stride;
 
                while (height--) {



Home | Main Index | Thread Index | Old Index