From: Xiang, Haihao Date: Tue, 6 Jan 2009 03:22:19 +0000 (+0800) Subject: dri: correct the damage. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7627c7f5dfa3b1bc7be9d1670668a81a70d9f64a;p=mesa.git dri: correct the damage. Fixes bug #17234 --- diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index e9b1a80b913..ae790554055 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -314,13 +314,28 @@ static void driReportDamage(__DRIdrawable *pdp, static void driSwapBuffers(__DRIdrawable *dPriv) { __DRIscreen *psp = dPriv->driScreenPriv; - + drm_clip_rect_t *rects; + int i; + if (!dPriv->numClipRects) return; psp->DriverAPI.SwapBuffers(dPriv); - driReportDamage(dPriv, dPriv->pClipRects, dPriv->numClipRects); + rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects); + + if (!rects) + return; + + for (i = 0; i < dPriv->numClipRects; i++) { + rects[i].x1 = dPriv->pClipRects[i].x1 - dPriv->x; + rects[i].y1 = dPriv->pClipRects[i].y1 - dPriv->y; + rects[i].x2 = dPriv->pClipRects[i].x2 - dPriv->x; + rects[i].y2 = dPriv->pClipRects[i].y2 - dPriv->y; + } + + driReportDamage(dPriv, rects, dPriv->numClipRects); + _mesa_free(rects); } static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,