diff src/redraw_man.c @ 29:f56c96b035a8

-
author Thinker K.F. Li <thinker@branda.to>
date Mon, 04 Aug 2008 21:13:32 +0800
parents 604bc90d509d
children e06a4a667ce2
line wrap: on
line diff
--- a/src/redraw_man.c	Mon Aug 04 20:08:37 2008 +0800
+++ b/src/redraw_man.c	Mon Aug 04 21:13:32 2008 +0800
@@ -376,6 +376,20 @@
     return _rdman_shape_changed(rdman, shape);
 }
 
+int rdman_paint_changed(redraw_man_t *rdman, paint_t *paint) {
+    shnode_t *node;
+    int r;
+
+    for(node = STAILQ_HEAD(paint->members);
+	node != NULL;
+	node = STAILQ_NEXT(shnode_t, next, node)) {
+	r = _rdman_shape_changed(rdman, node->shape);
+	if(r != OK)
+	    return ERR;
+    }
+    return OK;
+}
+
 /* Clean dirties */
 
 static void clean_shape(shape_t *shape) {
@@ -490,6 +504,21 @@
     return OK;
 }
 
+static int clean_rdman_dirties(redraw_man_t *rdman) {
+    int r;
+
+    r = clean_rdman_coords(rdman);
+    if(r != OK)
+	return ERR;
+
+    r = clean_rdman_geos(rdman);
+    if(r != OK)
+	return ERR;
+
+    return OK;
+}
+
+
 /* Drawing and Redrawing
  * ============================================================
  */
@@ -644,14 +673,10 @@
     int n_dirty_areas;
     area_t **dirty_areas;
 
-    r = clean_rdman_coords(rdman);
+    r = clean_rdman_dirties(rdman);
     if(r != OK)
 	return ERR;
 
-    r = clean_rdman_geos(rdman);
-    if(r != OK)
-	return ERR;
-    
     n_dirty_areas = rdman->n_dirty_areas;
     dirty_areas = rdman->dirty_areas;
     if(n_dirty_areas > 0) {
@@ -668,19 +693,19 @@
 
 int rdman_redraw_all(redraw_man_t *rdman) {
     geo_t *geo;
+    int r;
 
-    clean_rdman_coords(rdman);
-    rdman->n_dirty_areas = 0;
+    r = clean_rdman_dirties(rdman);
+    if(r != OK)
+	return ERR;
 
     for(geo = STAILQ_HEAD(rdman->all_geos);
 	geo != NULL;
 	geo = STAILQ_NEXT(geo_t, next, geo)) {
-	if(geo->flags & GEF_DIRTY)
-	    clean_shape(geo->shape);
 	draw_shape(rdman, geo->shape);
     }
     copy_cr_2_backend(rdman, 0, NULL);
-    rdman->n_dirty_geos = 0;
+    rdman->n_dirty_areas = 0;
 
     return OK;
 }
@@ -696,20 +721,6 @@
     return node;
 }
 
-int rdman_paint_changed(redraw_man_t *rdman, paint_t *paint) {
-    shnode_t *node;
-    int r;
-
-    for(node = STAILQ_HEAD(paint->members);
-	node != NULL;
-	node = STAILQ_NEXT(shnode_t, next, node)) {
-	r = _rdman_shape_changed(rdman, node->shape);
-	if(r != OK)
-	    return ERR;
-    }
-    return OK;
-}
-
 /*
  * Dirty of geo
  * A geo is dirty when any of the shape, size or positions is changed.