summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-12 22:47:41 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-12 22:53:48 +0100
commitaefc0417dde8b2137a787459a69d91c14902f22b (patch)
tree6865a1a5cace25dfdb0fad788c0b71963e890207
parent78a96e812b912c5b25a02670f603f455f93e9d00 (diff)
sna/damage: Simplify initialisation of damage extents
Just use the already computed region->extents when adding the first box. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_damage.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index 1cdfe225..e563db2f 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -251,7 +251,7 @@ _sna_damage_create_elt(struct sna_damage *damage,
}
assert(damage->remain >= 0);
- return damage;
+ return damage;
}
static struct sna_damage *
@@ -530,7 +530,12 @@ done:
static void damage_union(struct sna_damage *damage, const BoxRec *box)
{
- assert(box->x2 > box->x1 && box->y2 > box>y1);
+ DBG(("%s: extending damage (%d, %d), (%d, %d) by (%d, %d), (%d, %d)\n",
+ __FUNCTION__,
+ damage->extents.x1, damage->extents.y1,
+ damage->extents.x2, damage->extents.y2,
+ box->x1, box->y1, box->x2, box->y2));
+ assert(box->x2 > box->x1 && box->y2 > box->y1);
if (damage->extents.x2 < damage->extents.x1) {
damage->extents = *box;
} else {
@@ -574,11 +579,11 @@ static struct sna_damage *__sna_damage_add_box(struct sna_damage *damage,
switch (REGION_NUM_RECTS(&damage->region)) {
case 0:
pixman_region_init_rects(&damage->region, box, 1);
- damage_union(damage, box);
+ damage->extents = *box;
return damage;
case 1:
_pixman_region_union_box(&damage->region, box);
- damage_union(damage, box);
+ damage->extents = damage->region.extents;
return damage;
}
@@ -613,7 +618,7 @@ inline static struct sna_damage *__sna_damage_add(struct sna_damage *damage,
if (REGION_NUM_RECTS(&damage->region) <= 1) {
pixman_region_union(&damage->region, &damage->region, region);
- damage_union(damage, &region->extents);
+ damage->extents = damage->region.extents;
return damage;
}