summaryrefslogtreecommitdiff
path: root/src/sna/sna_damage.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-07-13 22:55:31 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-08-11 19:42:42 +0100
commit0e61e235bf7a926fd4e5b1f5a05b72dce4c450f3 (patch)
treef1cd3cb4c1ba51e7da16999c1f059ea484a26973 /src/sna/sna_damage.c
parent3a81bb6bafdbd37802dab96b8f05173ec6701d7f (diff)
sna/damage: Take advantage of marking all-damaged
Return early from adding new damage regions if we know that we have already marked it as all-damaged. 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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index 64b0c9e5..7358c3a7 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -325,6 +325,9 @@ inline static struct sna_damage *__sna_damage_add(struct sna_damage *damage,
if (!damage)
damage = _sna_damage_create();
+ if (damage->all)
+ return damage;
+
if (damage->mode == SUBTRACT)
__sna_damage_reduce(damage);
damage->mode = ADD;
@@ -391,6 +394,9 @@ inline static struct sna_damage *__sna_damage_add_box(struct sna_damage *damage,
if (!damage)
damage = _sna_damage_create();
+ if (damage->all)
+ return damage;
+
if (damage->mode == SUBTRACT)
__sna_damage_reduce(damage);
damage->mode = ADD;