DRI: Clip cliprects obtained from DRIGetDrawableInfo to screen dimensions.

This is to avoid issues with redirected windows which are located partly or
fully outside of a screen edge, resulting in unusual cliprects which the 3D
drivers generally can't handle. The symptoms in such cases would be incorrect
rendering or even crashes or hangs.
This commit is contained in:
Michel Dänzer 2007-06-11 09:23:19 +02:00
commit 1aceec61ff
3 changed files with 69 additions and 12 deletions

View file

@ -1518,13 +1518,18 @@ DRIGetDrawableInfo(ScreenPtr pScreen,
if (x1 > pScreen->width) x1 = pScreen->width;
if (y1 > pScreen->height) y1 = pScreen->height;
pDRIPriv->private_buffer_rect.x1 = x0;
pDRIPriv->private_buffer_rect.y1 = y0;
pDRIPriv->private_buffer_rect.x2 = x1;
pDRIPriv->private_buffer_rect.y2 = y1;
if (y0 >= y1 || x0 >= x1) {
*numBackClipRects = 0;
*pBackClipRects = NULL;
} else {
pDRIPriv->private_buffer_rect.x1 = x0;
pDRIPriv->private_buffer_rect.y1 = y0;
pDRIPriv->private_buffer_rect.x2 = x1;
pDRIPriv->private_buffer_rect.y2 = y1;
*numBackClipRects = 1;
*pBackClipRects = &(pDRIPriv->private_buffer_rect);
*numBackClipRects = 1;
*pBackClipRects = &(pDRIPriv->private_buffer_rect);
}
} else {
/* Use the frontbuffer cliprects for back buffers. */
*numBackClipRects = 0;