changeset 143:21db69d46835

Fix the problem that left-upper side of a moving shape will be flashed. It is because a coord without member always have a {x=0, y=0, w=1, h=1} geometry value. It cause most left-upper corner been updated. It also cause Cairo to update minmum area that include all updated pixels. So, left-upper side of a updated shape will be updated by Cairo by copy application buffer to window. It causes cursor flashing.
author Thinker K.F. Li <thinker@branda.to>
date Thu, 25 Sep 2008 01:42:49 +0800
parents 3efe77007127
children 7444dea34c6b
files src/geo.c
diffstat 1 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/geo.c	Wed Sep 24 23:40:40 2008 +0800
+++ b/src/geo.c	Thu Sep 25 01:42:49 2008 +0800
@@ -20,12 +20,11 @@
 }
 
 static int _is_overlay(area_t *r1, area_t *r2) {
-    if(!is_scale_overlay(r1->x, r1->w, r2->x, r2->w))
-	return 0;
-    if(!is_scale_overlay(r1->y, r1->h, r2->y, r2->h))
-	return 0;
-
-    return 1;
+    if(is_scale_overlay(r1->x, r1->w, r2->x, r2->w) &&
+       is_scale_overlay(r1->y, r1->h, r2->y, r2->h))
+	return 1;
+    
+    return 0;
 }
 
 int is_overlay(area_t *r1, area_t *r2) {
@@ -38,6 +37,14 @@
     co_aix x, y;
     int i;
     
+    if(n_pos == 0) {
+	area->x = 0;
+	area->w = 0;
+	area->y = 0;
+	area->h = 0;
+	return;
+    }
+
     min_x = max_x = pos[0][0];
     min_y = max_y = pos[0][1];
     for(i = 1; i < n_pos; i++) {