]> git.proxmox.com Git - spiceterm.git/commitdiff
iimplement efficient clear screen
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Oct 2013 09:32:12 +0000 (11:32 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Oct 2013 09:32:12 +0000 (11:32 +0200)
spiceterm.c

index 5a2edd3c87431858b8965cd907f02d5fcaccac38..5719c0683579bb2dafb65c9d05107dd08daa498f 100644 (file)
@@ -203,6 +203,28 @@ spiceterm_refresh(spiceTerm *vt)
     spiceterm_show_cursor(vt, 1);
 }
 
+static void
+spiceterm_clear_screen(spiceTerm *vt)
+{
+    int x, y;
+
+    for (y = 0; y <= vt->height; y++) {
+        int y1 = (vt->y_base + y) % vt->total_height;
+        TextCell *c = &vt->cells[y1 * vt->width];
+        for (x = 0; x < vt->width; x++) {
+            c->ch = ' ';
+            c->attrib = vt->default_attrib;
+            c->attrib.fgcol = vt->cur_attrib.fgcol;
+            c->attrib.bgcol = vt->cur_attrib.bgcol;
+           
+            c++;
+        }
+    }
+
+    spice_screen_clear(vt->screen, 0, 0, vt->screen->primary_width, 
+                       vt->screen->primary_height);
+}
+
 void
 spiceterm_unselect_all(spiceTerm *vt)
 {
@@ -922,11 +944,7 @@ spiceterm_putchar(spiceTerm *vt, gunichar2 ch)
                 break;
             case 2:
                 /* clear entire screen */
-                for (y = 0; y <= vt->height; y++) {
-                    for (x = 0; x < vt->width; x++) {
-                        spiceterm_clear_xy(vt, x, y);
-                    }
-                }
+                spiceterm_clear_screen(vt);
                 break;
             }
             break;