summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-04-09 10:22:49 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-04-09 10:24:26 +0100
commitcf4eb827861bf70d4d45a2ffe062d4c05a1564a6 (patch)
tree5fe4cc4ff4585b1e387674578b60e47d413d771b
parent9f40d7e91281b74df43f49885472ee352ea4b389 (diff)
sna: Restore empty region checking
commit 8ef81d676c52e42a6d9048fd92b2843470b62945 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Mon Apr 7 07:59:42 2014 +0100 sna: Simplify checking for singular damage overlooked that we were also checking for empty regions as well as singular regions. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_damage.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index f80ce229..f98c2827 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -55,11 +55,16 @@ struct sna_damage_box {
static struct sna_damage *__freed_damage;
-static inline bool region_is_singular(RegionRec *r)
+static inline bool region_is_singular(const RegionRec *r)
{
return r->data == NULL;
}
+static inline bool region_is_singular_or_empty(const RegionRec *r)
+{
+ return r->data == NULL || r->data->numRects == 0;
+}
+
#if HAS_DEBUG_FULL
static const char *_debug_describe_region(char *buf, int max,
const RegionRec *region)
@@ -641,7 +646,7 @@ static struct sna_damage *__sna_damage_add_box(struct sna_damage *damage,
break;
}
- if (damage->region.data == NULL ||
+ if (region_is_singular_or_empty(&damage->region) ||
box_contains_region(box, &damage->region)) {
_pixman_region_union_box(&damage->region, box);
assert(damage->region.extents.x2 > damage->region.extents.x1);
@@ -676,10 +681,10 @@ inline static struct sna_damage *__sna_damage_add(struct sna_damage *damage,
break;
}
- if (region->data == NULL)
+ if (region_is_singular(region))
return __sna_damage_add_box(damage, &region->extents);
- if (damage->region.data == NULL) {
+ if (region_is_singular_or_empty(&damage->region)) {
pixman_region_union(&damage->region, &damage->region, region);
assert(damage->region.extents.x2 > damage->region.extents.x1);
assert(damage->region.extents.y2 > damage->region.extents.y1);