diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-11 15:40:25 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-06-11 15:43:06 +0100 |
commit | a90160dcecf0a3df21a04b4f467e660f69ddae54 (patch) | |
tree | b86aa06f9603980567738cd253ad15ae0e17a22f /src/sna/sna_damage.h | |
parent | c9003c6d9602dba682e577ea7ce39990ea378db3 (diff) |
sna: Update damage pointer after the implicit reduction
sna_damage_contains_box() routine implicitly reduces the damage before
performing its check. This may alter and even destroy the damage entry,
so pass in the handle so that it can be updated correctly.
References: https://bugs.freedesktop.org/show_bug.cgi?id=77436
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 | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sna/sna_damage.h b/src/sna/sna_damage.h index 9b6f2135..4e4ef2b2 100644 --- a/src/sna/sna_damage.h +++ b/src/sna/sna_damage.h @@ -207,23 +207,27 @@ sna_damage_overlaps_box(const struct sna_damage *damage, return true; } -int _sna_damage_contains_box(struct sna_damage *damage, +int _sna_damage_contains_box(struct sna_damage **damage, const BoxRec *box); -static inline int sna_damage_contains_box(struct sna_damage *damage, +static inline int sna_damage_contains_box(struct sna_damage **damage, const BoxRec *box) { - if (DAMAGE_IS_ALL(damage)) + if (DAMAGE_IS_ALL(*damage)) return PIXMAN_REGION_IN; + if (*damage == NULL) + return PIXMAN_REGION_OUT; return _sna_damage_contains_box(damage, box); } -static inline int sna_damage_contains_box__offset(struct sna_damage *damage, +static inline int sna_damage_contains_box__offset(struct sna_damage **damage, const BoxRec *box, int dx, int dy) { BoxRec b; - if (DAMAGE_IS_ALL(damage)) + if (DAMAGE_IS_ALL(*damage)) return PIXMAN_REGION_IN; + if (*damage == NULL) + return PIXMAN_REGION_OUT; b = *box; b.x1 += dx; b.x2 += dx; |