Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Fix the eraserows operation, which was using an i...



details:   https://anonhg.NetBSD.org/src/rev/1d290569a082
branches:  trunk
changeset: 568788:1d290569a082
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Fri Jul 30 21:46:01 2004 +0000

description:
Fix the eraserows operation, which was using an incorrect value to paint
the background.  The problem was exposed when setting a non-black color
as the background, as the shift did not produce the expected fill value
(for black it worked because 0 is black).

diffstat:

 sys/dev/ic/vga_raster.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 92550235b72f -r 1d290569a082 sys/dev/ic/vga_raster.c
--- a/sys/dev/ic/vga_raster.c   Fri Jul 30 17:45:21 2004 +0000
+++ b/sys/dev/ic/vga_raster.c   Fri Jul 30 21:46:01 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vga_raster.c,v 1.12 2003/07/14 15:47:12 lukem Exp $    */
+/*     $NetBSD: vga_raster.c,v 1.13 2004/07/30 21:46:01 jmmv Exp $     */
 
 /*
  * Copyright (c) 2001, 2002 Bang Jun-Young
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.12 2003/07/14 15:47:12 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga_raster.c,v 1.13 2004/07/30 21:46:01 jmmv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1329,17 +1329,23 @@
        rascount = count * scr->type->fontheight;
 
        if (scr->active) {
+               u_int8_t bgcolor = (fillattr >> 4) & 0x0F;
+
                /* Paint background. */
                vga_gdc_write(vh, mode, 0x02);
-               if (scr->type->ncols % 4 == 0)
+               if (scr->type->ncols % 4 == 0) {
+                       u_int32_t fill = bgcolor | (bgcolor << 8) |
+                           (bgcolor << 16) | (bgcolor << 24);
                        /* We can speed up I/O */
                        for (i = rasoff; i < rasoff + rascount; i += 4)
                                bus_space_write_4(memt, memh,
-                                   scr->dispoffset + i, fillattr >> 4);
-               else
+                                   scr->dispoffset + i, fill);
+               } else {
+                       u_int16_t fill = bgcolor | (bgcolor << 8);
                        for (i = rasoff; i < rasoff + rascount; i += 2)
                                bus_space_write_2(memt, memh,
-                                   scr->dispoffset + i, fillattr >> 4);
+                                   scr->dispoffset + i, fill);
+               }
        }
        for (i = 0; i < count; i++) {
                scr->mem[off + i].ch = ' ';



Home | Main Index | Thread Index | Old Index