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>
This commit is contained in:
Chris Wilson 2011-06-16 11:23:16 +01:00
parent 3c02110052
commit 2ff36af7e1
1 changed files with 6 additions and 0 deletions

View File

@ -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",