summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-06-16 11:23:16 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-06-16 11:24:39 +0100
commit2ff36af7e1841a82fd43a9317d07b3229a309df5 (patch)
tree596ef69528b779a1dc577ff9ea6f406044cc9cff
parent3c02110052ecf69d43577ed8537a8850227da560 (diff)
sna/accel: Prevent initialising a region with an invalid box
pixman complains if you attempt to use a region created with an invalid box, so don't do that. Reported-by: Reinhard Karcher <reinhard.karcher@gmx.net> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 9e03caf5..0a0cd8fb 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -969,6 +969,8 @@ sna_put_image(DrawablePtr drawable, GCPtr gc, int depth,
box.x2 = pixmap->drawable.width;
if (box.y2 > pixmap->drawable.height)
box.y2 = pixmap->drawable.height;
+ if (BOX_EMPTY(&box))
+ return;
RegionInit(&region, &box, 1);
@@ -2756,6 +2758,8 @@ sna_image_glyph(DrawablePtr drawable, GCPtr gc,
box.y1 = y - FONTASCENT(gc->font);
box.y2 = y + FONTDESCENT(gc->font);
TRIM_BOX(box, drawable);
+ if (BOX_EMPTY(box))
+ return;
TRANSLATE_BOX(box, drawable);
DBG(("%s: extents(%d, %d), (%d, %d)\n",
@@ -2793,6 +2797,8 @@ sna_poly_glyph(DrawablePtr drawable, GCPtr gc,
box.y2 = y + extents.overallDescent;
TRIM_BOX(box, drawable);
+ if (BOX_EMPTY(box))
+ return;
TRANSLATE_BOX(box, drawable);
DBG(("%s: extents(%d, %d), (%d, %d)\n",