dri: correct the damage.
authorXiang, Haihao <haihao.xiang@intel.com>
Tue, 6 Jan 2009 03:22:19 +0000 (11:22 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 6 Jan 2009 03:22:19 +0000 (11:22 +0800)
Fixes bug #17234

src/mesa/drivers/dri/common/dri_util.c

index e9b1a80b913f8270164d64cf0445818a4a2281e3..ae790554055e1902546c7f25b4cd7c266a624383 100644 (file)
@@ -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,