sna: Check for zero-sized damage regions after trimming Windows to their pixmaps

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-06-15 11:08:18 +01:00
parent 293a867ea5
commit b3659beec8
1 changed files with 8 additions and 5 deletions

View File

@ -1736,6 +1736,11 @@ out:
return true;
}
static inline bool box_empty(const BoxRec *box)
{
return box->x2 <= box->x1 || box->y2 <= box->y1;
}
bool
sna_drawable_move_to_cpu(DrawablePtr drawable, unsigned flags)
{
@ -1770,6 +1775,9 @@ sna_drawable_move_to_cpu(DrawablePtr drawable, unsigned flags)
if (region.extents.y2 > pixmap->drawable.height)
region.extents.y2 = pixmap->drawable.height;
if (box_empty(&region.extents))
return true;
return sna_drawable_move_region_to_cpu(&pixmap->drawable, &region, flags);
}
@ -2714,11 +2722,6 @@ static inline void box32_add_rect(Box32Rec *box, const xRectangle *r)
box->y2 = v;
}
static inline bool box_empty(const BoxRec *box)
{
return box->x2 <= box->x1 || box->y2 <= box->y1;
}
static Bool
sna_put_image_upload_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
int x, int y, int w, int h, char *bits, int stride)