[PATCH 4/4] Make GC clientClip always be a region.

Jamey Sharp jamey at minilop.net
Tue Jul 13 15:55:41 PDT 2010


Nothing ever set clientClip to anything but a region or NULL, so delete
the clientClipType field and change clientClip from (pointer) to
(RegionPtr).

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
 dix/gc.c                   |   51 +++++++++----------------------------------
 exa/exa_accel.c            |   18 +++++++-------
 exa/exa_priv.h             |    6 ++--
 exa/exa_unaccel.c          |    6 ++--
 hw/dmx/dmxgc.c             |   50 ++++++++++++++++++-------------------------
 hw/kdrive/src/kxv.c        |    2 +-
 hw/xfree86/common/xf86xv.c |    2 +-
 hw/xfree86/xaa/xaaBitBlt.c |    4 +-
 hw/xnest/GC.c              |   44 ++++++++++++-------------------------
 include/gcstruct.h         |    5 +--
 mi/micopy.c                |    4 +-
 mi/miexpose.c              |    2 +-
 mi/migc.c                  |    4 +-
 mi/mioverlay.c             |    2 +-
 xfixes/region.c            |   25 +++++++--------------
 15 files changed, 81 insertions(+), 144 deletions(-)

diff --git a/dix/gc.c b/dix/gc.c
index ed7e963..f734749 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -523,8 +523,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
     pGC->graphicsExposures = TRUE;
     pGC->clipOrg.x = 0;
     pGC->clipOrg.y = 0;
-    pGC->clientClipType = CT_NONE;
-    pGC->clientClip = (pointer)NULL;
+    pGC->clientClip = NULL;
     pGC->numInDashList = 2;
     pGC->dash = DefaultDash;
     pGC->dashOffset = 0;
@@ -836,7 +835,6 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
     pGC->graphicsExposures = TRUE;
     pGC->clipOrg.x = 0;
     pGC->clipOrg.y = 0;
-    pGC->clientClipType = CT_NONE;
     pGC->dashOffset = 0;
     pGC->numInDashList = 2;
     pGC->dash = DefaultDash;
@@ -1087,22 +1085,10 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
 static void
 DestroyClip(GCPtr pGC)
 {
-    if (pGC->clientClipType == CT_NONE)
+    if (!pGC->clientClip)
 	return;
-    else if (pGC->clientClipType == CT_PIXMAP)
-    {
-	(*pGC->pScreen->DestroyPixmap) ((PixmapPtr) (pGC->clientClip));
-    }
-    else
-    {
-	/*
-	 * we know we'll never have a list of rectangles, since ChangeClip
-	 * immediately turns them into a region
-	 */
-	RegionDestroy(pGC->clientClip);
-    }
+    RegionDestroy(pGC->clientClip);
     pGC->clientClip = NULL;
-    pGC->clientClipType = CT_NONE;
 }
 
 void
@@ -1112,8 +1098,7 @@ ChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
     if (type == CT_PIXMAP)
     {
 	/* convert the pixmap to a region */
-	pGC->clientClip = (pointer) BitmapToRegion(pGC->pScreen,
-							(PixmapPtr) pvalue);
+	pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue);
 	(*pGC->pScreen->DestroyPixmap) (pvalue);
     }
     else if (type == CT_REGION)
@@ -1123,35 +1108,21 @@ ChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
     }
     else if (type != CT_NONE)
     {
-	pGC->clientClip = (pointer) RegionFromRects(nrects,
-						      (xRectangle *) pvalue,
-								    type);
+	pGC->clientClip = RegionFromRects(nrects, (xRectangle *) pvalue, type);
 	free(pvalue);
     }
-    pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION : CT_NONE;
     pGC->stateChanges |= GCClipMask;
 }
 
 static void
 CopyClip(GCPtr pgcDst, GCPtr pgcSrc)
 {
-    RegionPtr prgnNew;
-
-    switch (pgcSrc->clientClipType)
-    {
-	case CT_PIXMAP:
-	    ((PixmapPtr) pgcSrc->clientClip)->refcnt++;
-	    /* Fall through !! */
-	case CT_NONE:
-	    ChangeClip(pgcDst, (int) pgcSrc->clientClipType,
-		    pgcSrc->clientClip, 0);
-	    break;
-	case CT_REGION:
-	    prgnNew = RegionCreate(NULL, 1);
-	    RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
-	    ChangeClip(pgcDst, CT_REGION, prgnNew, 0);
-	    break;
-    }
+    if (pgcSrc->clientClip) {
+	RegionPtr prgnNew = RegionCreate(NULL, 1);
+	RegionCopy(prgnNew, pgcSrc->clientClip);
+	ChangeClip(pgcDst, CT_REGION, prgnNew, 0);
+    } else
+	ChangeClip(pgcDst, CT_NONE, NULL, 0);
 }
 
 /*
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 6c677c7..77ce05e 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -421,7 +421,7 @@ exaHWCopyNtoN (DrawablePtr    pSrcDrawable,
 
 	if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
 					   pGC->fillStyle, pGC->alu,
-					   pGC->clientClipType)) {
+					   pGC->clientClip)) {
 	    dstregion = RegionCreate(NullBox, 0);
 	    RegionCopy(dstregion, srcregion);
 	    RegionTranslate(dstregion, dst_off_x - dx - src_off_x,
@@ -768,7 +768,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
 
 static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,
 				Pixel pixel, CARD32 planemask, CARD32 alu,
-				unsigned int clientClipType);
+				RegionPtr clientClip);
 
 static void
 exaPolyFillRect(DrawablePtr pDrawable,
@@ -816,11 +816,11 @@ exaPolyFillRect(DrawablePtr pDrawable,
 	if (((pGC->fillStyle == FillSolid || pGC->tileIsPixel) &&
 	     exaFillRegionSolid(pDrawable, pReg, pGC->fillStyle == FillSolid ?
 				pGC->fgPixel : pGC->tile.pixel,	pGC->planemask,
-				pGC->alu, pGC->clientClipType)) ||
+				pGC->alu, pGC->clientClip)) ||
 	    (pGC->fillStyle == FillTiled && !pGC->tileIsPixel &&
 	     exaFillRegionTiled(pDrawable, pReg, pGC->tile.pixmap, &pGC->patOrg,
 				pGC->planemask, pGC->alu,
-				pGC->clientClipType))) {
+				pGC->clientClip))) {
 	    goto out;
 	}
     }
@@ -998,7 +998,7 @@ fallback:
 
 static Bool
 exaFillRegionSolid (DrawablePtr	pDrawable, RegionPtr pRegion, Pixel pixel,
-		    CARD32 planemask, CARD32 alu, unsigned int clientClipType)
+		    CARD32 planemask, CARD32 alu, RegionPtr clientClip)
 {
     ExaScreenPriv(pDrawable->pScreen);
     PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
@@ -1019,7 +1019,7 @@ exaFillRegionSolid (DrawablePtr	pDrawable, RegionPtr pRegion, Pixel pixel,
 	pixmaps[0].as_src = FALSE;
 	pixmaps[0].pPix = pPixmap;
 	pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
-						alu, clientClipType) ? NULL : pRegion;
+						alu, clientClip) ? NULL : pRegion;
 
 	exaDoMigration (pixmaps, 1, TRUE);
     }
@@ -1082,7 +1082,7 @@ out:
 Bool
 exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
 		    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
-		    unsigned int clientClipType)
+		    RegionPtr clientClip)
 {
     ExaScreenPriv(pDrawable->pScreen);
     PixmapPtr pPixmap;
@@ -1104,7 +1104,7 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
     if (tileWidth == 1 && tileHeight == 1)
 	return exaFillRegionSolid(pDrawable, pRegion,
 				  exaGetPixmapFirstPixel (pTile), planemask,
-				  alu, clientClipType);
+				  alu, clientClip);
 
     pPixmap = exaGetDrawablePixmap (pDrawable);
     pExaPixmap = ExaGetPixmapPriv (pPixmap);
@@ -1120,7 +1120,7 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
 	pixmaps[0].as_src = FALSE;
 	pixmaps[0].pPix = pPixmap;
 	pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
-						alu, clientClipType) ? NULL : pRegion;
+						alu, clientClip) ? NULL : pRegion;
 	pixmaps[1].as_dst = FALSE;
 	pixmaps[1].as_src = TRUE;
 	pixmaps[1].pPix = pTile;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 8e8f668..9687cb8 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -450,11 +450,11 @@ ExaCheckAddTraps (PicturePtr	pPicture,
 static _X_INLINE Bool
 exaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
 		      unsigned int fillStyle, unsigned char alu,
-		      unsigned int clientClipType)
+		      RegionPtr clientClip)
 {
     return ((alu != GXcopy && alu != GXclear && alu != GXset &&
 	     alu != GXcopyInverted) || fillStyle == FillStippled ||
-	    clientClipType != CT_NONE || !EXA_PM_IS_SOLID(pDrawable, planemask));
+	    clientClip != NullRegion || !EXA_PM_IS_SOLID(pDrawable, planemask));
 }
 
 void
@@ -463,7 +463,7 @@ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
 Bool
 exaFillRegionTiled (DrawablePtr	pDrawable, RegionPtr pRegion, PixmapPtr pTile,
 		    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
-		    unsigned int clientClipType);
+		    RegionPtr clientClip);
 
 void
 exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index a078cc1..020e7ac 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -106,7 +106,7 @@ ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
     EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
     if (!pExaScr->prepare_access_reg || !pExaPixmap->pDamage ||
 	exaGCReadsDestination(pDrawable, pGC->planemask, pGC->fillStyle,
-			      pGC->alu, pGC->clientClipType))
+			      pGC->alu, pGC->clientClip))
 	exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
     else
 	pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST,
@@ -140,7 +140,7 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst,  GCPtr pGC,
 
     if (pExaScr->prepare_access_reg &&
 	!exaGCReadsDestination(pDst, pGC->planemask, pGC->fillStyle,
-			       pGC->alu, pGC->clientClipType)) {
+			       pGC->alu, pGC->clientClip)) {
 	PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
 
 	exaGetDrawableDeltas(pSrc, pPixmap, &xoff, &yoff);
@@ -176,7 +176,7 @@ ExaFallbackPrepareReg(DrawablePtr pDrawable,
 					      pGC->planemask,
 					      pGC->fillStyle,
 					      pGC->alu,
-					      pGC->clientClipType))) {
+					      pGC->clientClip))) {
 	BoxRec box;
 	RegionRec reg;
 	int xoff, yoff;
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index feb1958..02f93d0 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -188,38 +188,30 @@ static void dmxBEChangeClip(GCPtr pGC)
     ScreenPtr      pScreen = pGC->pScreen;
     DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
     dmxGCPrivPtr   pGCPriv = DMX_GET_GC_PRIV(pGC);
-    XRectangle    *pRects;
-    BoxPtr         pBox;
-    int            i, nRects;
 
-    /* Set the client clip on the back-end server */
-    switch (pGC->clientClipType) {
-    case CT_NONE:
-	if (dmxScreen->beDisplay)
-	    XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
-	break;
+    if (!dmxScreen->beDisplay)
+	return;
 
-    case CT_REGION:
-	if (dmxScreen->beDisplay) {
-	    nRects = RegionNumRects((RegionPtr)pGC->clientClip);
-	    pRects = malloc(nRects * sizeof(*pRects));
-	    pBox   = RegionRects((RegionPtr)pGC->clientClip);
-
-	    for (i = 0; i < nRects; i++) {
-		pRects[i].x      = pBox[i].x1;
-		pRects[i].y      = pBox[i].y1;
-		pRects[i].width  = pBox[i].x2 - pBox[i].x1;
-		pRects[i].height = pBox[i].y2 - pBox[i].y1;
-	    }
-
-	    XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
-			       pGC->clipOrg.x, pGC->clipOrg.y,
-			       pRects, nRects, Unsorted);
-
-	    free(pRects);
+    /* Set the client clip on the back-end server */
+    if (pGC->clientClip) {
+	int i, nRects = RegionNumRects(pGC->clientClip);
+	XRectangle *pRects = malloc(nRects * sizeof(*pRects));
+	BoxPtr pBox = RegionRects(pGC->clientClip);
+
+	for (i = 0; i < nRects; i++) {
+	    pRects[i].x      = pBox[i].x1;
+	    pRects[i].y      = pBox[i].y1;
+	    pRects[i].width  = pBox[i].x2 - pBox[i].x1;
+	    pRects[i].height = pBox[i].y2 - pBox[i].y1;
 	}
-	break;
-    }
+
+	XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
+			   pGC->clipOrg.x, pGC->clipOrg.y,
+			   pRects, nRects, Unsorted);
+
+	free(pRects);
+    } else
+	XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
 }
 
 /** Set the values in the graphics context on the back-end server
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index c07829a..11fc20a 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -633,7 +633,7 @@ KdXVCopyClip(
    GCPtr pGC
 ){
     /* copy the new clip if it exists */
-    if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
+    if(pGC->clientClip) {
 	if(!portPriv->clientClip)
 	    portPriv->clientClip = RegionCreate(NullBox, 1);
 	/* Note: this is in window coordinates */
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index c1d3199..2e8f709 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -685,7 +685,7 @@ xf86XVCopyClip(
    GCPtr pGC
 ){
     /* copy the new clip if it exists */
-    if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
+    if(pGC->clientClip) {
 	if(!portPriv->clientClip)
 	    portPriv->clientClip = RegionCreate(NullBox, 1);
 	/* Note: this is in window coordinates */
diff --git a/hw/xfree86/xaa/xaaBitBlt.c b/hw/xfree86/xaa/xaaBitBlt.c
index 5148ed4..c576f49 100644
--- a/hw/xfree86/xaa/xaaBitBlt.c
+++ b/hw/xfree86/xaa/xaaBitBlt.c
@@ -65,7 +65,7 @@ XAABitBlt(
 
     /* clip the source */
     if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
-	if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+	if ((pSrcDrawable == pDstDrawable) && !pGC->clientClip)
 	    prgnSrcClip = pGC->pCompositeClip;
 	else
 	    fastClip = 1;
@@ -78,7 +78,7 @@ XAABitBlt(
 		 */
 		fastClip = 1;
 	    } else if ((pSrcDrawable == pDstDrawable) &&
-		(pGC->clientClipType == CT_NONE)) {
+		!pGC->clientClip) {
 		prgnSrcClip = pGC->pCompositeClip;
 	    } else {
 		prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index d9fb2ab..dcc8019 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -90,37 +90,21 @@ xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 static void
 xnestChangeClip(GCPtr pGC)
 {
-  int i, size, nRects;
-  BoxPtr pBox;
-  XRectangle *pRects;
-
-  switch(pGC->clientClipType)
-    {
-    case CT_NONE:
-      XSetClipMask(xnestDisplay, xnestGC(pGC), None);
-      break;
-
-    case CT_REGION:
-      nRects = RegionNumRects((RegionPtr) pGC->clientClip);
-      size = nRects * sizeof(*pRects);
-      pRects = (XRectangle *) malloc(size);
-      pBox = RegionRects((RegionPtr) pGC->clientClip);
-      for (i = nRects; i-- > 0; ) {
-	pRects[i].x = pBox[i].x1;
-	pRects[i].y = pBox[i].y1;
-	pRects[i].width = pBox[i].x2 - pBox[i].x1;
-	pRects[i].height = pBox[i].y2 - pBox[i].y1;
-      }
-      XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
-			 pRects, nRects, Unsorted);
-      free((char *) pRects);
-      break;
-
-    case CT_PIXMAP:
-      XSetClipMask(xnestDisplay, xnestGC(pGC),
-		   xnestPixmap((PixmapPtr) pGC->clientClip));
-      break;
+  if (pGC->clientClip) {
+    int i, nRects = RegionNumRects((RegionPtr) pGC->clientClip);
+    XRectangle *pRects = malloc(nRects * sizeof(*pRects));
+    BoxPtr pBox = RegionRects((RegionPtr) pGC->clientClip);
+    for (i = nRects; i-- > 0; ) {
+      pRects[i].x = pBox[i].x1;
+      pRects[i].y = pBox[i].y1;
+      pRects[i].width = pBox[i].x2 - pBox[i].x1;
+      pRects[i].height = pBox[i].y2 - pBox[i].y1;
     }
+    XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
+		       pRects, nRects, Unsorted);
+    free((char *) pRects);
+  } else
+    XSetClipMask(xnestDisplay, xnestGC(pGC), None);
 }
 
 void
diff --git a/include/gcstruct.h b/include/gcstruct.h
index 28403f0..486d38a 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -278,13 +278,12 @@ typedef struct _GC {
     unsigned int 	arcMode : 1;
     unsigned int	subWindowMode : 1;
     unsigned int	graphicsExposures : 1;
-    unsigned int	clientClipType : 2; /* CT_<kind> */
     unsigned int	miTranslate:1; /* should mi things translate? */
     unsigned int	tileIsPixel:1; /* tile is solid pixel */
     unsigned int	fExpose:1;     /* Call exposure handling */
     unsigned int	freeCompClip:1;  /* Free composite clip */
     unsigned int	scratch_inuse:1; /* is this GC in a pool for reuse? */
-    unsigned int	unused:13; /* see comment above */
+    unsigned int	unused:15; /* see comment above */
     unsigned long	planemask;
     unsigned long	fgPixel;
     unsigned long	bgPixel;
@@ -297,7 +296,7 @@ typedef struct _GC {
     DDXPointRec		patOrg;		/* origin for (tile, stipple) */
     struct _Font	*font;
     DDXPointRec		clipOrg;
-    pointer		clientClip;
+    RegionPtr		clientClip;
     unsigned long	stateChanges;	/* masked with GC_<kind> */
     unsigned long       serialNumber;
     const GCFuncs	*funcs;
diff --git a/mi/micopy.c b/mi/micopy.c
index 027c461..0de8c58 100644
--- a/mi/micopy.c
+++ b/mi/micopy.c
@@ -192,7 +192,7 @@ miDoCopy (DrawablePtr	pSrcDrawable,
     /* Compute source clip region */
     if (pSrcDrawable->type == DRAWABLE_PIXMAP)
     {
-	if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+	if ((pSrcDrawable == pDstDrawable) && !pGC->clientClip)
 	    prgnSrcClip = miGetCompositeClip(pGC);
 	else
 	    fastSrc = TRUE;
@@ -215,7 +215,7 @@ miDoCopy (DrawablePtr	pSrcDrawable,
 		fastSrc = TRUE;
 	    }
 	    else if ((pSrcDrawable == pDstDrawable) &&
-		     (pGC->clientClipType == CT_NONE))
+		     !pGC->clientClip)
 	    {
 		prgnSrcClip = miGetCompositeClip(pGC);
 	    }
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 94258b8..6bfbdb1 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -251,7 +251,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
     RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip);
 
     /* intersect with client clip region. */
-    if (pGC->clientClipType == CT_REGION)
+    if (pGC->clientClip)
 	RegionIntersect(&rgnExposed, &rgnExposed, pGC->clientClip);
 
     /*
diff --git a/mi/migc.c b/mi/migc.c
index dce1f30..bf9cf5a 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -88,7 +88,7 @@ miComputeCompositeClip( GCPtr pGC, DrawablePtr pDrawable)
 	 * regions.  (this wins especially if many clients clip by children
 	 * and have no client clip.)
 	 */
-	if (pGC->clientClipType == CT_NONE)
+	if (!pGC->clientClip)
 	{
 	    if (freeCompClip)
 		RegionDestroy(pGC->pCompositeClip);
@@ -155,7 +155,7 @@ miComputeCompositeClip( GCPtr pGC, DrawablePtr pDrawable)
 	    pGC->pCompositeClip = RegionCreate(&pixbounds, 1);
 	}
 
-	if (pGC->clientClipType == CT_REGION)
+	if (pGC->clientClip)
 	{
 	    if(pDrawable->x || pDrawable->y) {
 	        RegionTranslate(pGC->clientClip,
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index 766c5e7..fe2063d 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -1745,7 +1745,7 @@ miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
 	freeTmpClip = FALSE;
     }
     freeCompClip = pGC->freeCompClip;
-    if (pGC->clientClipType == CT_NONE) {
+    if (!pGC->clientClip) {
 	if (freeCompClip) 
 	    RegionDestroy(pGC->pCompositeClip);
 	pGC->pCompositeClip = pregWin;
diff --git a/xfixes/region.c b/xfixes/region.c
index 8880da4..eb0e47b 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -213,7 +213,7 @@ SProcXFixesCreateRegionFromWindow (ClientPtr client)
 int
 ProcXFixesCreateRegionFromGC (ClientPtr client)
 {
-    RegionPtr	pRegion, pClip;
+    RegionPtr	pRegion;
     GCPtr	pGC;
     int 	rc;
     REQUEST (xXFixesCreateRegionFromGCReq);
@@ -224,23 +224,14 @@ ProcXFixesCreateRegionFromGC (ClientPtr client)
     rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess);
     if (rc != Success)
 	return rc;
-    
-    switch (pGC->clientClipType) {
-    case CT_PIXMAP:
-	pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
-	if (!pRegion)
-	    return BadAlloc;
-	break;
-    case CT_REGION:
-	pClip = (RegionPtr) pGC->clientClip;
-	pRegion = XFixesRegionCopy (pClip);
-	if (!pRegion)
-	    return BadAlloc;
-	break;
-    default:
+
+    if (!pGC->clientClip)
 	return BadImplementation;   /* assume sane server bits */
-    }
-    
+
+    pRegion = XFixesRegionCopy (pGC->clientClip);
+    if (!pRegion)
+	return BadAlloc;
+
     if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
 	return BadAlloc;
     
-- 
1.7.0



More information about the xorg-devel mailing list