sna: Restore empty region checking
commit 8ef81d676c
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>
This commit is contained in:
parent
9f40d7e912
commit
cf4eb82786
|
|
@ -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, ®ion->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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue