tech-kern archive

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

Fixing rasops32_putchar_aa() in sys/dev/rasops/rasops32.c



Hi,

This patch fixes drawing the underlining in rasops32_putchar_aa. Without this
patch, the underlining would be drawn above the character, since the pointer
rp would still point at the left-upper corner of the cell when reaching the
underlining code. I added the code for also handling the hp and hrp
variables because it's also done in the other putchar functions.

I only tested this patch on NetBSD/amd64, by using a dumb framebuffer driver
and choosing one of the alpha blended fonts in the config.

Index: sys/dev/rasops/rasops32.c
===================================================================
RCS file: /cvsroot/src/sys/dev/rasops/rasops32.c,v
retrieving revision 1.27
diff -u -r1.27 rasops32.c
--- sys/dev/rasops/rasops32.c   21 Mar 2013 21:01:10 -0000      1.27
+++ sys/dev/rasops/rasops32.c   22 Jul 2013 07:47:48 -0000
@@ -225,13 +225,22 @@
                b1 =  clr[1] & 0xff;
 
                for (y = 0; y < height; y++) {
-                       dp = (uint32_t *)(rrp + ri->ri_stride * y);
+                       dp = rp;
+                       DELTA(rp, ri->ri_stride, int32_t *);
+                       if (ri->ri_hwbits) {
+                               hp = hrp;
+                               DELTA(hrp, ri->ri_stride, int32_t *);
+                       }
                        for (x = 0; x < width; x++) {
                                aval = *fr;
                                if (aval == 0) {
                                        *dp = clr[0];
+                                       if (ri->ri_hwbits)
+                                               *hp = clr[0];
                                } else if (aval == 255) {
                                        *dp = clr[1];
+                                       if (ri->ri_hwbits)
+                                               *hp = clr[1];
                                } else {
                                        r = aval * r1 + (255 - aval) * r0;
                                        g = aval * g1 + (255 - aval) * g0;
@@ -239,8 +248,15 @@
                                        *dp = (r & 0xff00) << 8 | 
                                              (g & 0xff00) | 
                                              (b & 0xff00) >> 8;
+                                       if (ri->ri_hwbits) {
+                                               *hp = (r & 0xff00) << 8 | 
+                                                     (g & 0xff00) | 
+                                                     (b & 0xff00) >> 8;
+                                       }
                                }
                                dp++;
+                               if (ri->ri_hwbits)
+                                       hp++;
                                fr++;
                        }
                }


Home | Main Index | Thread Index | Old Index