diff options
author | kstailey <kstailey@cvs.openbsd.org> | 1997-07-10 04:25:58 +0000 |
---|---|---|
committer | kstailey <kstailey@cvs.openbsd.org> | 1997-07-10 04:25:58 +0000 |
commit | 906755d37e395ce04a8a239d941d63a93366fa6e (patch) | |
tree | 5653256c31923b4ab360b5ee8e05c8d3d095c4f1 /sys/arch | |
parent | 7e9c5aa542e56eb321cdb0f8cd4c92b204456582 (diff) |
fix backward scrolling
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/alpha/dev/vga.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/arch/alpha/dev/vga.c b/sys/arch/alpha/dev/vga.c index fccac6205ec..fa97e6a9ff6 100644 --- a/sys/arch/alpha/dev/vga.c +++ b/sys/arch/alpha/dev/vga.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vga.c,v 1.2 1997/07/09 03:07:39 deraadt Exp $ */ +/* $OpenBSD: vga.c,v 1.3 1997/07/10 04:25:57 kstailey Exp $ */ /* $NetBSD: vga.c,v 1.3 1996/12/02 22:24:54 cgd Exp $ */ /* @@ -322,6 +322,8 @@ vga_erasecols(id, row, startcol, ncols) bus_space_set_region_2(vc->vc_memt, vc->vc_memh, off, val, ncols); } +/* be careful not to call bus_space_copy_2() with overlapping regions */ + void vga_copyrows(id, srcrow, dstrow, nrows) void *id; @@ -333,9 +335,19 @@ vga_copyrows(id, srcrow, dstrow, nrows) srcoff = (srcrow * vc->vc_ncol + 0) * 2; dstoff = (dstrow * vc->vc_ncol + 0) * 2; - /* XXX SHOULDN'T USE THIS IF REGIONS OVERLAP... */ - bus_space_copy_2(vc->vc_memt, vc->vc_memh, srcoff, vc->vc_memh, dstoff, - nrows * vc->vc_ncol); + if (nrows == 0 || srcrow == dstrow) + return; + + if (srcrow < dstrow && srcrow + nrows > dstrow) { + int srow, drow; + + for (srow = srcrow + nrows - 1, drow = dstrow + nrows - 1; + srow >= srcrow; srow--, drow--) { + vga_copyrows(id, srow, drow, 1); + } + } else + bus_space_copy_2(vc->vc_memt, vc->vc_memh, srcoff, + vc->vc_memh, dstoff, nrows * vc->vc_ncol); } void |