diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-03 12:09:51 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-03 21:35:03 +0000 |
commit | 294c8791c435acf5933109fbcab85623a55b2c6c (patch) | |
tree | f92acb9315f0898e753142427833564ae717ffb5 /src/sna/sna_damage.c | |
parent | 7ff42e9c83cdb17660a64901497704b38032af8c (diff) |
sna: Use a cheaper no-reduction damage check for simply discarding further damage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_damage.c')
-rw-r--r-- | src/sna/sna_damage.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c index 7431f39e..4cccbdcd 100644 --- a/src/sna/sna_damage.c +++ b/src/sna/sna_damage.c @@ -970,7 +970,7 @@ static bool box_contains(const BoxRec *a, const BoxRec *b) return true; } -static inline Bool sna_damage_maybe_contains_box(struct sna_damage *damage, +static inline Bool sna_damage_maybe_contains_box(const struct sna_damage *damage, const BoxRec *box) { if (box->x2 <= damage->extents.x1 || @@ -1190,6 +1190,21 @@ int sna_damage_contains_box(struct sna_damage *damage, } #endif +bool sna_damage_contains_box__no_reduce(const struct sna_damage *damage, + const BoxRec *box) +{ + int ret; + + assert(damage && damage->mode != DAMAGE_ALL); + if (!sna_damage_maybe_contains_box(damage, box)) + return false; + + ret = pixman_region_contains_rectangle((RegionPtr)&damage->region, + (BoxPtr)box); + return (!damage->dirty || damage->mode == DAMAGE_ADD) && + ret == PIXMAN_REGION_IN; +} + static Bool _sna_damage_intersect(struct sna_damage *damage, RegionPtr region, RegionPtr result) { |