Mercurial > MadButterfly
comparison src/geo.c @ 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 | 0f3baa488a62 |
children | 7444dea34c6b |
comparison
equal
deleted
inserted
replaced
142:3efe77007127 | 143:21db69d46835 |
---|---|
18 } | 18 } |
19 return 1; | 19 return 1; |
20 } | 20 } |
21 | 21 |
22 static int _is_overlay(area_t *r1, area_t *r2) { | 22 static int _is_overlay(area_t *r1, area_t *r2) { |
23 if(!is_scale_overlay(r1->x, r1->w, r2->x, r2->w)) | 23 if(is_scale_overlay(r1->x, r1->w, r2->x, r2->w) && |
24 return 0; | 24 is_scale_overlay(r1->y, r1->h, r2->y, r2->h)) |
25 if(!is_scale_overlay(r1->y, r1->h, r2->y, r2->h)) | 25 return 1; |
26 return 0; | 26 |
27 | 27 return 0; |
28 return 1; | |
29 } | 28 } |
30 | 29 |
31 int is_overlay(area_t *r1, area_t *r2) { | 30 int is_overlay(area_t *r1, area_t *r2) { |
32 return _is_overlay(r1, r2); | 31 return _is_overlay(r1, r2); |
33 } | 32 } |
36 co_aix min_x, max_x; | 35 co_aix min_x, max_x; |
37 co_aix min_y, max_y; | 36 co_aix min_y, max_y; |
38 co_aix x, y; | 37 co_aix x, y; |
39 int i; | 38 int i; |
40 | 39 |
40 if(n_pos == 0) { | |
41 area->x = 0; | |
42 area->w = 0; | |
43 area->y = 0; | |
44 area->h = 0; | |
45 return; | |
46 } | |
47 | |
41 min_x = max_x = pos[0][0]; | 48 min_x = max_x = pos[0][0]; |
42 min_y = max_y = pos[0][1]; | 49 min_y = max_y = pos[0][1]; |
43 for(i = 1; i < n_pos; i++) { | 50 for(i = 1; i < n_pos; i++) { |
44 x = pos[i][0]; | 51 x = pos[i][0]; |
45 if(x < min_x) | 52 if(x < min_x) |