xf86-video-intel: src/sna/sna_damage.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Jun 5 13:37:48 PDT 2012
src/sna/sna_damage.c | 8 ++++++++
1 file changed, 8 insertions(+)
New commits:
commit 1dafb4777f8378c87f34feae667582498220204c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Jun 5 21:25:40 2012 +0100
sna/damage: Add some assertions to validate that each damage box is non-empty
References: https://bugs.freedesktop.org/show_bug.cgi?id=50744
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index b97edbe..dd67364 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -671,8 +671,10 @@ __sna_damage_add_boxes(struct sna_damage *damage,
break;
}
+ assert(box[0].x2 > box[0].x1 && box[0].y2 > box[0].y1);
extents = box[0];
for (i = 1; i < n; i++) {
+ assert(box[i].x2 > box[i].x1 && box[i].y2 > box[i].y1);
if (extents.x1 > box[i].x1)
extents.x1 = box[i].x1;
if (extents.x2 < box[i].x2)
@@ -738,11 +740,13 @@ __sna_damage_add_rectangles(struct sna_damage *damage,
assert(n);
+ assert(r[0].width && r[0].height);
extents.x1 = r[0].x;
extents.x2 = r[0].x + r[0].width;
extents.y1 = r[0].y;
extents.y2 = r[0].y + r[0].height;
for (i = 1; i < n; i++) {
+ assert(r[i].width && r[i].height);
if (extents.x1 > r[i].x)
extents.x1 = r[i].x;
if (extents.x2 < r[i].x + r[i].width)
@@ -1074,6 +1078,8 @@ fastcall struct sna_damage *_sna_damage_subtract(struct sna_damage *damage,
inline static struct sna_damage *__sna_damage_subtract_box(struct sna_damage *damage,
const BoxRec *box)
{
+ assert(box->x2 > box->x1 && box->y2 > box->y1);
+
if (damage == NULL)
return NULL;
@@ -1156,8 +1162,10 @@ static struct sna_damage *__sna_damage_subtract_boxes(struct sna_damage *damage,
assert(n);
+ assert(box[0].x2 > box[0].x1 && box[0].y2 > box[0].y1);
extents = box[0];
for (i = 1; i < n; i++) {
+ assert(box[i].x2 > box[i].x1 && box[i].y2 > box[i].y1);
if (extents.x1 > box[i].x1)
extents.x1 = box[i].x1;
if (extents.x2 < box[i].x2)
More information about the xorg-commit
mailing list