Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Dec 2008 09:50:24 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 154170 for review
Message-ID:  <200812060950.mB69oOBt050961@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=154170

Change 154170 by ed@ed_dull on 2008/12/06 09:49:43

	Fix to copy():
	
	When copying non-contiguous lines of text, we should progress
	line by line, not the width of our copying region per line.
	
	Also keep fill() a little more in sync with copy().

Affected files ...

.. //depot/projects/mpsafetty/sys/dev/syscons/scterm-teken.c#10 edit

Differences ...

==== //depot/projects/mpsafetty/sys/dev/syscons/scterm-teken.c#10 (text+ko) ====

@@ -288,6 +288,7 @@
 	scr_stat *scp = arg;
 	u_char *map;
 	u_char ch = c;
+	unsigned int width;
 	int attr, row;
 
 	attr = scteken_attr(a);
@@ -300,11 +301,12 @@
 		    map[ch], attr);
 	} else {
 		/* Fill display line by line. */
+		width = r->tr_end.tp_col - r->tr_begin.tp_col;
+
 		for (row = r->tr_begin.tp_row; row < r->tr_end.tp_row; row++) {
 			sc_vtb_erase(&scp->vtb, r->tr_begin.tp_row *
 			    scp->xsize + r->tr_begin.tp_col,
-			    r->tr_end.tp_col - r->tr_begin.tp_col,
-			    map[ch], attr);
+			    width, map[ch], attr);
 		}
 	}
 
@@ -319,7 +321,7 @@
 scteken_copy(void *arg, const teken_rect_t *r, const teken_pos_t *p)
 {
 	scr_stat *scp = arg;
-	unsigned int stride;
+	unsigned int width;
 	int src, dst, end;
 
 	if (r->tr_begin.tp_col == 0 && r->tr_end.tp_col == scp->xsize) {
@@ -329,7 +331,7 @@
 		    (r->tr_end.tp_row - r->tr_begin.tp_row) * scp->xsize);
 	} else {
 		/* Copy line by line. */
-		stride = r->tr_end.tp_col - r->tr_begin.tp_col;
+		width = r->tr_end.tp_col - r->tr_begin.tp_col;
 
 		if (p->tp_row < r->tr_begin.tp_row) {
 			/* Copy from top to bottom. */
@@ -340,10 +342,10 @@
 			dst = p->tp_row * scp->xsize + p->tp_col;
 
 			while (src < end) {
-				sc_vtb_move(&scp->vtb, src, dst, stride);
+				sc_vtb_move(&scp->vtb, src, dst, width);
 			
-				src += stride;
-				dst += stride;
+				src += scp->xsize;
+				dst += scp->xsize;
 			}
 		} else {
 			/* Copy from bottom to top. */
@@ -355,10 +357,10 @@
 			    r->tr_begin.tp_row - 1) * scp->xsize + p->tp_col;
 
 			while (src >= end) {
-				sc_vtb_move(&scp->vtb, src, dst, stride);
+				sc_vtb_move(&scp->vtb, src, dst, width);
 			
-				src -= stride;
-				dst -= stride;
+				src -= scp->xsize;
+				dst -= scp->xsize;
 			}
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812060950.mB69oOBt050961>