PERFORCE change 154124 for review

Ed Schouten ed at FreeBSD.org
Fri Dec 5 10:06:05 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=154124

Change 154124 by ed at ed_dull on 2008/12/05 18:06:00

	Commit this WIP piece of code, so I can test it at another location.

Affected files ...

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

Differences ...

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

@@ -264,14 +264,18 @@
     const teken_attr_t *a)
 {
 	scr_stat *scp = arg;
-	u_char *map = scp->sc->scr_map;
+	u_char *map;
 	u_char ch = c;
 	vm_offset_t p;
-	int cursor;
+	int cursor, attr;
+
+	attr = scteken_attr(a);
+	map = scp->sc->scr_map;
 
 	cursor = tp->tp_row * scp->xsize + tp->tp_col;
 	p = sc_vtb_pointer(&scp->vtb, cursor);
-	sc_vtb_putchar(&scp->vtb, p, map[ch], scteken_attr(a));
+	sc_vtb_putchar(&scp->vtb, p, map[ch], attr);
+
 	mark_for_update(scp, cursor);
 	/* XXX: why? */
 	mark_for_update(scp, imin(cursor + 1, scp->xsize * scp->ysize - 1));
@@ -281,14 +285,30 @@
 scteken_fill(void *arg, const teken_rect_t *r, teken_char_t c,
     const teken_attr_t *a)
 {
-	teken_pos_t p;
+	scr_stat *scp = arg;
+	u_char *map;
+	int attr, row;
+
+	attr = scteken_attr(a);
+	map = scp->sc->scr_map;
+
+	if (r->tr_begin.tp_col == 0 && r->tr_end.tp_col == scp->xsize) {
+		/* Single contiguous region to fill. */
+		vtb_erase(&scp->vtb, r->tr_begin.tp_row * scp->xsize,
+		    (r->tr_end.tp_row - r->tr_begin.tp_row) * scp->xsize,
+		    map[ch], attr);
+	} else {
+		/* Fill display line by line. */
+		for (row = r->tr_begin.tp_row; row < r->tr_end.tp_row; row++) {
+			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);
+		}
+	}
 
-	/* Braindead implementation of fill() - just call putchar(). */
-	for (p.tp_row = r->tr_begin.tp_row;
-	    p.tp_row < r->tr_end.tp_row; p.tp_row++)
-		for (p.tp_col = r->tr_begin.tp_col;
-		    p.tp_col < r->tr_end.tp_col; p.tp_col++)
-			scteken_putchar(arg, &p, c, a);
+	/* XXX: bad! */
+	mark_for_update(scp, r->tr_begin.tp_row * scp->xsize + r->tr_begin.tp_col);
+	mark_for_update(scp, (r->tr_end.tp_row - 1) * scp->xsize + (r->tr_end.tp_col - 1));
 }
 
 static void


More information about the p4-projects mailing list