summaryrefslogtreecommitdiff
path: root/src/sna/sna_damage.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-06-14 17:06:19 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-06-14 17:08:03 +0100
commitb415ca05c2e1c4f09f85d8769d39e5369661ed3a (patch)
treee55529e1368cb9b6e35c94b2d702ea45b123a624 /src/sna/sna_damage.c
parent0df7c488640d3590d2a88dc353b72167b6644eaa (diff)
sna: Reset damage extents after reduction goes to zero
If the reduction of the damage clears all of the boxes, we need to reset the -infinite extents so that we continue to accumulate further damage. Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=50744 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_damage.c')
-rw-r--r--src/sna/sna_damage.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index 6149be7f..bdd6a5e8 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -164,6 +164,12 @@ reset_embedded_box(struct sna_damage *damage)
list_init(&damage->embedded_box.list);
}
+static void reset_extents(struct sna_damage *damage)
+{
+ damage->extents.x1 = damage->extents.y1 = MAXSHORT;
+ damage->extents.x2 = damage->extents.y2 = MINSHORT;
+}
+
static struct sna_damage *_sna_damage_create(void)
{
struct sna_damage *damage;
@@ -179,8 +185,7 @@ static struct sna_damage *_sna_damage_create(void)
reset_embedded_box(damage);
damage->mode = DAMAGE_ADD;
pixman_region_init(&damage->region);
- damage->extents.x1 = damage->extents.y1 = MAXSHORT;
- damage->extents.x2 = damage->extents.y2 = MINSHORT;
+ reset_extents(damage);
return damage;
}
@@ -498,6 +503,7 @@ static void __sna_damage_reduce(struct sna_damage *damage)
pixman_region_fini(region);
pixman_region_init_rects(region, boxes, nboxes);
+ assert(!pixman_region_not_empty(region));
assert(damage->extents.x1 == region->extents.x1 &&
damage->extents.y1 == region->extents.y1 &&
damage->extents.x2 == region->extents.x2 &&
@@ -513,7 +519,10 @@ static void __sna_damage_reduce(struct sna_damage *damage)
damage->extents.y1 <= region->extents.y1 &&
damage->extents.x2 >= region->extents.x2 &&
damage->extents.y2 >= region->extents.y2);
- damage->extents = region->extents;
+ if (pixman_region_not_empty(region))
+ damage->extents = region->extents;
+ else
+ reset_extents(damage);
}
free(free_boxes);