Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rasops rasops32_putchar_aa():



details:   https://anonhg.NetBSD.org/src/rev/d153dd475249
branches:  trunk
changeset: 788966:d153dd475249
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Jul 31 19:58:23 2013 +0000

description:
rasops32_putchar_aa():
- underline the right characters
- make drawing slightly less horribly inefficient
- don't pretend to support a shadow fb

diffstat:

 sys/dev/rasops/rasops32.c |  44 ++++++++++++++------------------------------
 1 files changed, 14 insertions(+), 30 deletions(-)

diffs (109 lines):

diff -r 2e4d0dc094e3 -r d153dd475249 sys/dev/rasops/rasops32.c
--- a/sys/dev/rasops/rasops32.c Wed Jul 31 19:50:47 2013 +0000
+++ b/sys/dev/rasops/rasops32.c Wed Jul 31 19:58:23 2013 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops32.c,v 1.27 2013/03/21 21:01:10 martin Exp $    */
+/*      $NetBSD: rasops32.c,v 1.28 2013/07/31 19:58:23 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.27 2013/03/21 21:01:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.28 2013/07/31 19:58:23 macallan Exp $");
 
 #include "opt_rasops.h"
 
@@ -165,14 +165,13 @@
        int width, height, cnt, fs, clr[2];
        struct rasops_info *ri = (struct rasops_info *)cookie;
        struct wsdisplay_font *font = PICK_FONT(ri, uc);
-       int32_t *dp, *rp, *hp, *hrp;
+       int32_t *dp, *rp;
        uint8_t *rrp;
        u_char *fr;
+       uint32_t buffer[64]; /* XXX */
        int x, y, r, g, b, aval;
        int r1, g1, b1, r0, g0, b0;
 
-       hp = hrp = NULL;
-
 #ifdef RASOPS_CLIPPING
        /* Catches 'row < 0' case too */
        if ((unsigned)row >= (unsigned)ri->ri_rows)
@@ -188,9 +187,6 @@
 
        rrp = (ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
        rp = (int32_t *)rrp;
-       if (ri->ri_hwbits)
-               hrp = (int32_t *)(ri->ri_hwbits + row*ri->ri_yscale +
-                   col*ri->ri_xscale);
 
        height = font->fontheight;
        width = font->fontwidth;
@@ -199,19 +195,12 @@
        clr[1] = ri->ri_devcmap[(attr >> 24) & 0xf];
 
        if (uc == ' ') {
+               for (cnt = 0; cnt < width; cnt++)
+                       buffer[cnt] = clr[0];
                while (height--) {
                        dp = rp;
                        DELTA(rp, ri->ri_stride, int32_t *);
-                       if (ri->ri_hwbits) {
-                               hp = hrp;
-                               DELTA(hrp, ri->ri_stride, int32_t *);
-                       }
-
-                       for (cnt = width; cnt; cnt--) {
-                               *dp++ = clr[0];
-                               if (ri->ri_hwbits)
-                                       *hp++ = clr[0];
-                       }
+                       memcpy(dp, buffer, width << 2);
                }
        } else {
                fr = WSFONT_GLYPH(uc, font);
@@ -229,33 +218,28 @@
                        for (x = 0; x < width; x++) {
                                aval = *fr;
                                if (aval == 0) {
-                                       *dp = clr[0];
+                                       buffer[x] = clr[0];
                                } else if (aval == 255) {
-                                       *dp = clr[1];
+                                       buffer[x] = clr[1];
                                } else {
                                        r = aval * r1 + (255 - aval) * r0;
                                        g = aval * g1 + (255 - aval) * g0;
                                        b = aval * b1 + (255 - aval) * b0;
-                                       *dp = (r & 0xff00) << 8 | 
+                                       buffer[x] = (r & 0xff00) << 8 | 
                                              (g & 0xff00) | 
                                              (b & 0xff00) >> 8;
                                }
-                               dp++;
                                fr++;
                        }
+                       memcpy(dp, buffer, width << 2);
                }
        }
 
        /* Do underline */
        if ((attr & 1) != 0) {
-               DELTA(rp, -(ri->ri_stride << 1), int32_t *);
-               if (ri->ri_hwbits)
-                       DELTA(hrp, -(ri->ri_stride << 1), int32_t *);
-
-               while (width--) {
+               rp = (uint32_t *)rrp;                         
+               DELTA(rp, (ri->ri_stride * (height - 2)), int32_t *);
+               while (width--)
                        *rp++ = clr[1];
-                       if (ri->ri_hwbits)
-                               *hrp++ = clr[1];
-               }
        }
 }



Home | Main Index | Thread Index | Old Index