On 09/26/2011 10:53 PM, Jamey Sharp wrote:
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<[email protected]>
---
  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 e7568fc..d33f934 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 5600539..21e8741 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);
      }
@@ -1084,7 +1084,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;
@@ -1106,7 +1106,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);
@@ -1122,7 +1122,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 70de4bd..64b2671 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -449,11 +449,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
@@ -462,7 +462,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 219f903..9f237e9 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,
@@ -139,7 +139,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)&&
         RegionInitBoxes (&reg, pbox, nbox)) {
         PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);

@@ -175,7 +175,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 b1347c1..8ec9b22 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 50dc235..fcd2ebb 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -630,7 +630,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 b46dfef..c5ac9f5 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -695,7 +695,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 049dbfb..3d50b90 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 579350b..ac99ffd 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; ) {

Whitespace error: "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);

While you're at it, could you remove this cast please?

+  } else
+    XSetClipMask(xnestDisplay, xnestGC(pGC), None);

I'm wavering between asking you to fix the indentation since you're replacing the whole function anyway, but it would make the file inconsistent. Better to change it all at one go, I guess.

  }

  void
diff --git a/include/gcstruct.h b/include/gcstruct.h
index fb9ee0d..ed598fc 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>  */

This leaves a misleading comment in gc.h:

/* clientClipType field in GC */
#define CT_NONE                 0
#define CT_PIXMAP               1
#define CT_REGION               2
[...]

      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;
      GCFuncs            *funcs;
diff --git a/mi/micopy.c b/mi/micopy.c
index 652c620..2fb40f5 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 0f1ebe5..ce02b13 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 606bf7a..7017334 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -210,7 +210,7 @@ SProcXFixesCreateRegionFromWindow (ClientPtr client)
  int
  ProcXFixesCreateRegionFromGC (ClientPtr client)
  {
-    RegionPtr  pRegion, pClip;
+    RegionPtr  pRegion;
      GCPtr      pGC;
      int        rc;
      REQUEST (xXFixesCreateRegionFromGCReq);
@@ -221,23 +221,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.5.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to