diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-10-18 17:30:18 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-10-18 20:40:46 +0100 |
commit | db086d02affe5109202dc9ee06c9e728a3ff0f3f (patch) | |
tree | dbcbeae8051d8900d570e0755c2e5f92af5656ae | |
parent | eedcac9a2d1e3ab7c6e35135995d960e55dcad54 (diff) |
sna: Do a quick pass on dirty damage before reduction
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_damage.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c index b921d940..5730a25d 100644 --- a/src/sna/sna_damage.c +++ b/src/sna/sna_damage.c @@ -1277,7 +1277,8 @@ fastcall struct sna_damage *_sna_damage_subtract_boxes(struct sna_damage *damage static int __sna_damage_contains_box(struct sna_damage *damage, const BoxRec *box) { - int ret; + const BoxRec *b; + int n, count, ret; if (!damage) return PIXMAN_REGION_OUT; @@ -1295,9 +1296,29 @@ static int __sna_damage_contains_box(struct sna_damage *damage, if (damage->mode == DAMAGE_ADD) { if (ret == PIXMAN_REGION_IN) return ret; + + count = damage->embedded_box.size; + if (list_is_empty(&damage->embedded_box.list)) + count -= damage->remain; + + b = damage->embedded_box.box; + for (n = 0; n < count; n++) { + if (box_contains(&b[n], box)) + return PIXMAN_REGION_IN; + } } else { if (ret == PIXMAN_REGION_OUT) return ret; + + count = damage->embedded_box.size; + if (list_is_empty(&damage->embedded_box.list)) + count -= damage->remain; + + b = damage->embedded_box.box; + for (n = 0; n < count; n++) { + if (box_contains(&b[n], box)) + return PIXMAN_REGION_OUT; + } } __sna_damage_reduce(damage); |