dri2: Allocate cliprect as part of the __DRIdrawableRec
authorKristian Høgsberg <krh@bitplanet.net>
Mon, 15 Feb 2010 20:15:05 +0000 (15:15 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 16 Feb 2010 15:38:50 +0000 (10:38 -0500)
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h

index f5e7923835f715bfa6cf9c3689acf705449b6193..befe1675a04805cbd0ef5efba35ff054684354f2 100644 (file)
@@ -485,8 +485,8 @@ dri2CreateNewDrawable(__DRIscreen *screen,
     if (!pdraw)
        return NULL;
 
-    pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects);
-    pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects);
+    pdraw->pClipRects = &pdraw->dri2.clipRect;
+    pdraw->pBackClipRects = &pdraw->dri2.clipRect;
 
     return pdraw;
 }
@@ -507,11 +507,11 @@ static void dri_put_drawable(__DRIdrawable *pdp)
 
        psp = pdp->driScreenPriv;
         (*psp->DriverAPI.DestroyBuffer)(pdp);
-       if (pdp->pClipRects) {
+       if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
            _mesa_free(pdp->pClipRects);
            pdp->pClipRects = NULL;
        }
-       if (pdp->pBackClipRects) {
+       if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
            _mesa_free(pdp->pBackClipRects);
            pdp->pBackClipRects = NULL;
        }
index e9d5a9d98642c382f09e14089d2cbd914bc5b858..8d02524f3865d187022ed48291c8becfa43f17ce 100644 (file)
@@ -378,6 +378,10 @@ struct __DRIdrawableRec {
     unsigned int swap_interval;
 
     GLboolean validBuffers;
+
+    struct {
+       drm_clip_rect_t clipRect;
+    } dri2;
 };
 
 /**