diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-08-18 16:16:17 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-08-18 17:35:15 +0100 |
commit | e361627b90ea6bf2f9a8c46cf8debe562fdf4f09 (patch) | |
tree | 287dabf38255ca7ba4a0bb0d5caf0bb29efd1087 | |
parent | 10f334872e9dd190e18c768219e60815acabe4d3 (diff) |
sna/damage: Add some more sanity checks for creating empty regions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_damage.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c index 7d783729..c7fe4c6b 100644 --- a/src/sna/sna_damage.c +++ b/src/sna/sna_damage.c @@ -552,6 +552,8 @@ static void damage_union(struct sna_damage *damage, const BoxRec *box) if (damage->extents.y2 < box->y2) damage->extents.y2 = box->y2; } + assert(damage->extents.x2 > damage->extents.x1); + assert(damage->extents.y2 > damage->extents.y1); } static void _pixman_region_union_box(RegionRec *region, const BoxRec *box) @@ -581,6 +583,8 @@ static struct sna_damage *__sna_damage_add_box(struct sna_damage *damage, if (REGION_NUM_RECTS(&damage->region) <= 1) { _pixman_region_union_box(&damage->region, box); + assert(damage->region.extents.x2 > damage->region.extents.x1); + assert(damage->region.extents.y2 > damage->region.extents.y1); damage_union(damage, box); return damage; } @@ -616,6 +620,8 @@ 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); + assert(damage->region.extents.x2 > damage->region.extents.x1); + assert(damage->region.extents.y2 > damage->region.extents.y1); damage_union(damage, ®ion->extents); return damage; } @@ -645,6 +651,8 @@ fastcall struct sna_damage *_sna_damage_add(struct sna_damage *damage, ErrorF(" = %s\n", _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + assert(damage->region.extents.x2 > damage->region.extents.x1); + assert(damage->region.extents.y2 > damage->region.extents.y1); return damage; } @@ -726,6 +734,8 @@ struct sna_damage *_sna_damage_add_boxes(struct sna_damage *damage, ErrorF(" = %s\n", _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + assert(damage->region.extents.x2 > damage->region.extents.x1); + assert(damage->region.extents.y2 > damage->region.extents.y1); return damage; } @@ -811,6 +821,8 @@ struct sna_damage *_sna_damage_add_rectangles(struct sna_damage *damage, ErrorF(" = %s\n", _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + assert(damage->region.extents.x2 > damage->region.extents.x1); + assert(damage->region.extents.y2 > damage->region.extents.y1); return damage; } @@ -893,6 +905,8 @@ struct sna_damage *_sna_damage_add_points(struct sna_damage *damage, ErrorF(" = %s\n", _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + assert(damage->region.extents.x2 > damage->region.extents.x1); + assert(damage->region.extents.y2 > damage->region.extents.y1); return damage; } @@ -919,6 +933,8 @@ fastcall struct sna_damage *_sna_damage_add_box(struct sna_damage *damage, ErrorF(" = %s\n", _debug_describe_damage(damage_buf, sizeof(damage_buf), damage)); + assert(damage->region.extents.x2 > damage->region.extents.x1); + assert(damage->region.extents.y2 > damage->region.extents.y1); return damage; } |