sna: Assert that the subtract operation does reduce an all-damaged

Somewhere somewhen it appears that I am discarding the all-damaged flag
on the pointer. The only possibility I can see is for a no-op
subtraction, so put an assert there just in case the impossible is
happening.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-01-23 10:54:13 +00:00
parent 2908fe2df7
commit 267493f391
1 changed files with 3 additions and 0 deletions

View File

@ -101,6 +101,7 @@ static inline bool sna_damage_is_all(struct sna_damage **_damage,
case DAMAGE_SUBTRACT:
return false;
default:
assert(0);
case DAMAGE_ADD:
if (damage->extents.x2 < width || damage->extents.x1 > 0)
return false;
@ -140,6 +141,7 @@ static inline void sna_damage_subtract(struct sna_damage **damage,
RegionPtr region)
{
*damage = _sna_damage_subtract(DAMAGE_PTR(*damage), region);
assert(*damage == NULL || (*damage)->mode != DAMAGE_ALL);
}
fastcall struct sna_damage *_sna_damage_subtract_box(struct sna_damage *damage,
@ -148,6 +150,7 @@ static inline void sna_damage_subtract_box(struct sna_damage **damage,
const BoxRec *box)
{
*damage = _sna_damage_subtract_box(DAMAGE_PTR(*damage), box);
assert(*damage == NULL || (*damage)->mode != DAMAGE_ALL);
}
Bool _sna_damage_intersect(struct sna_damage *damage,