diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-12 19:35:43 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-11-12 20:08:13 +0000 |
commit | 87147b63e905c3566ac1c12e0712f068e90d5e2e (patch) | |
tree | 7ffcbaed6feb0c1e623afea8ee7d2dd27bdbde8a /src/sna/sna_damage.h | |
parent | e8799cdea461df5102d421fda26fecceae79b929 (diff) |
sna/damage: Reduce the damage for evaluating sna_damage_is_all
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_damage.h')
-rw-r--r-- | src/sna/sna_damage.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/sna/sna_damage.h b/src/sna/sna_damage.h index 2dc27375..c62e8310 100644 --- a/src/sna/sna_damage.h +++ b/src/sna/sna_damage.h @@ -79,9 +79,6 @@ static inline bool sna_damage_is_all(struct sna_damage **damage, if (*damage == NULL) return false; - if ((*damage)->n) - return false; - switch ((*damage)->mode) { case DAMAGE_ALL: return true; @@ -89,6 +86,10 @@ static inline bool sna_damage_is_all(struct sna_damage **damage, return false; default: case DAMAGE_ADD: + if ((*damage)->extents.x2 < width || (*damage)->extents.x1 > 0) + return false; + if ((*damage)->extents.y2 < height || (*damage)->extents.y1 > 0) + return false; *damage = _sna_damage_is_all(*damage, width, height); return (*damage)->mode == DAMAGE_ALL; } @@ -126,13 +127,15 @@ int sna_damage_contains_box(struct sna_damage *damage, int sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes); -struct sna_damage *_sna_damage_reduce(struct sna_damage *damage); -static inline void sna_damage_reduce(struct sna_damage **damage) +struct sna_damage *_sna_damage_reduce(struct sna_damage *damage, + int width, int height); +static inline void sna_damage_reduce(struct sna_damage **damage, + int width, int height) { if (*damage == NULL) return; - *damage = _sna_damage_reduce(*damage); + *damage = _sna_damage_reduce(*damage, width, height); } void __sna_damage_destroy(struct sna_damage *damage); |