[PATCH 10/13] dix: Move GC clip management up from GC funcs to dix

Adam Jackson ajax at redhat.com
Tue Nov 23 11:45:45 PST 2010


None of the GC funcs wrappers were doing anything special with the
cliplist representation, nor is that really a likely thing to want to
do.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 Xext/panoramiX.c                       |   32 -------
 dix/gc.c                               |   76 +++++++++++++++--
 exa/exa.c                              |   48 ----------
 fb/fbgc.c                              |    3 -
 hw/dmx/dmxgc.c                         |   82 ------------------
 hw/xfree86/common/xf86VGAarbiter.c     |   31 +-------
 hw/xfree86/common/xf86VGAarbiterPriv.h |    4 -
 hw/xfree86/shadowfb/shadow.c           |   35 --------
 hw/xfree86/xaa/xaaGC.c                 |   33 -------
 hw/xnest/GC.c                          |  147 --------------------------------
 hw/xnest/XNGC.h                        |    4 -
 hw/xwin/wingc.c                        |   42 ---------
 include/dix.h                          |   18 ++++
 include/gcstruct.h                     |   13 ---
 mi/mibitblt.c                          |    4 +-
 mi/migc.c                              |   70 ---------------
 mi/migc.h                              |   17 ----
 miext/cw/cw.c                          |   52 +-----------
 miext/damage/damage.c                  |   31 -------
 miext/rootless/rootlessGC.c            |   29 ------
 render/mirect.c                        |    2 +-
 xfixes/region.c                        |    2 +-
 22 files changed, 96 insertions(+), 679 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index b73c53f..8dc3d8f 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -123,13 +123,9 @@ static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
 static void XineramaChangeGC(GCPtr, unsigned long);
 static void XineramaCopyGC(GCPtr, unsigned long, GCPtr);
 static void XineramaDestroyGC(GCPtr);
-static void XineramaChangeClip(GCPtr, int, pointer, int);
-static void XineramaDestroyClip(GCPtr);
-static void XineramaCopyClip(GCPtr, GCPtr);
 
 static GCFuncs XineramaGCFuncs = {
     XineramaValidateGC, XineramaChangeGC, XineramaCopyGC, XineramaDestroyGC,
-    XineramaChangeClip, XineramaDestroyClip, XineramaCopyClip
 };
 
 #define Xinerama_GC_FUNC_PROLOGUE(pGC)\
@@ -293,34 +289,6 @@ XineramaCopyGC (
     Xinerama_GC_FUNC_EPILOGUE (pGCDst);
 }
 
-static void
-XineramaChangeClip (
-    GCPtr   pGC,
-    int		type,
-    pointer	pvalue,
-    int		nrects 
-){
-    Xinerama_GC_FUNC_PROLOGUE (pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    Xinerama_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-XineramaCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    Xinerama_GC_FUNC_PROLOGUE (pgcDst);
-    (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
-    Xinerama_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-XineramaDestroyClip(GCPtr pGC)
-{
-    Xinerama_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    Xinerama_GC_FUNC_EPILOGUE (pGC);
-}
-
 int
 XineramaDeleteResource(pointer data, XID id)
 {
diff --git a/dix/gc.c b/dix/gc.c
index fc251dd..8339374 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -81,6 +81,71 @@ ValidateGC(DrawablePtr pDraw, GC *pGC)
     pGC->serialNumber = pDraw->serialNumber;
 }
 
+/* GC clip management */
+
+void
+DestroyClip(GCPtr pGC)
+{
+    if (pGC->clientClipType == CT_NONE)
+	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);
+    }
+    pGC->clientClip = NULL;
+    pGC->clientClipType = CT_NONE;
+}
+
+void
+ChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
+{
+    if (type == CT_PIXMAP)
+    {
+	/* convert the pixmap to a region */
+	pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue);
+	(*pGC->pScreen->DestroyPixmap) (pvalue);
+    }
+    else if (type == CT_REGION)
+    {
+	/* stuff the region in the GC */
+	pGC->clientClip = pvalue;
+    }
+    else if (type != CT_NONE)
+    {
+	pGC->clientClip = RegionFromRects(nrects, (xRectangle *) pvalue, type);
+	free(pvalue);
+    }
+    pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION
+                                                               : CT_NONE;
+    pGC->stateChanges |= GCClipMask;
+}
+
+void
+CopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+    RegionPtr       prgnNew;
+
+    switch (pgcSrc->clientClipType)
+    {
+      case CT_PIXMAP:
+	((PixmapPtr) pgcSrc->clientClip)->refcnt++;
+        break;
+      case CT_NONE:
+	break;
+      case CT_REGION:
+	prgnNew = RegionCreate(NULL, 1);
+	RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
+	break;
+    }
+}
 
 /*
  * ChangeGC/ChangeGCXIDs:
@@ -338,8 +403,7 @@ ChangeGC(ClientPtr client, GC *pGC, BITS32 mask, ChangeGCValPtr pUnion)
 		    }
 		    pPixmap->refcnt++;
 		}
-		(*pGC->funcs->ChangeClip)(pGC, pPixmap ? CT_PIXMAP : CT_NONE,
-					  (pointer)pPixmap, 0);
+                ChangeClip(pGC, pPixmap ? CT_PIXMAP : CT_NONE, pPixmap, 0);
 		break;
 	    case GCDashOffset:
 		NEXTVAL(INT16, pGC->dashOffset);
@@ -708,7 +772,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
 		pgcDst->clipOrg.y = pgcSrc->clipOrg.y;
 		break;
 	    case GCClipMask:
-		(* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+		CopyClip(pgcDst, pgcSrc);
 		break;
 	    case GCDashOffset:
 		pgcDst->dashOffset = pgcSrc->dashOffset;
@@ -772,7 +836,7 @@ FreeGC(pointer value, XID gid)
     GCPtr pGC = (GCPtr)value;
 
     CloseFont(pGC->font, (Font)0);
-    (* pGC->funcs->DestroyClip)(pGC);
+    DestroyClip(pGC);
 
     if (!pGC->tileIsPixel)
 	(* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
@@ -1077,7 +1141,7 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
 
     if (size)
 	memmove((char *)prectsNew, (char *)prects, size);
-    (*pGC->funcs->ChangeClip)(pGC, newct, (pointer)prectsNew, nrects);
+    ChangeClip(pGC, newct, prectsNew, nrects);
     if (pGC->funcs->ChangeGC)
 	(*pGC->funcs->ChangeGC) (pGC, GCClipXOrigin|GCClipYOrigin|GCClipMask);
     return Success;
@@ -1122,7 +1186,7 @@ GetScratchGC(unsigned depth, ScreenPtr pScreen)
 	    pGC->clipOrg.x = 0;
 	    pGC->clipOrg.y = 0;
 	    if (pGC->clientClipType != CT_NONE)
-		(*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
+		ChangeClip(pGC, CT_NONE, NULL, 0);
 	    pGC->stateChanges = GCAllBits;
 	    return pGC;
 	}
diff --git a/exa/exa.c b/exa/exa.c
index 8adf847..780aa25 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -479,29 +479,11 @@ exaCopyGC (GCPtr pGCSrc,
 	      unsigned long mask,
 	      GCPtr	 pGCDst);
 
-static void
-exaChangeClip (GCPtr pGC,
-		int type,
-		pointer pvalue,
-		int nrects);
-
-static void
-exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
-
-static void
-exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
-
-static void
-exaDestroyClip(GCPtr pGC);
-
 const GCFuncs exaGCFuncs = {
     exaValidateGC,
     exaChangeGC,
     exaCopyGC,
     exaDestroyGC,
-    exaChangeClip,
-    exaDestroyClip,
-    exaCopyClip
 };
 
 static void
@@ -589,36 +571,6 @@ exaCopyGC (GCPtr pGCSrc,
     swap(pExaGC, pGCDst, funcs);
 }
 
-static void
-exaChangeClip (GCPtr pGC,
-		int type,
-		pointer pvalue,
-		int nrects)
-{
-    ExaGCPriv(pGC);
-    swap(pExaGC, pGC, funcs);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    swap(pExaGC, pGC, funcs);
-}
-
-static void
-exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
-{
-    ExaGCPriv(pGCDst);
-    swap(pExaGC, pGCDst, funcs);
-    (*pGCDst->funcs->CopyClip)(pGCDst, pGCSrc);
-    swap(pExaGC, pGCDst, funcs);
-}
-
-static void
-exaDestroyClip(GCPtr pGC)
-{
-    ExaGCPriv(pGC);
-    swap(pExaGC, pGC, funcs);
-    (*pGC->funcs->DestroyClip)(pGC);
-    swap(pExaGC, pGC, funcs);
-}
-
 /**
  * exaCreateGC makes a new GC and hooks up its funcs handler, so that
  * exaValidateGC() will get called.
diff --git a/fb/fbgc.c b/fb/fbgc.c
index b27a030..1db3771 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -33,9 +33,6 @@ const GCFuncs fbGCFuncs = {
     miChangeGC,
     miCopyGC,
     miDestroyGC,
-    miChangeClip,
-    miDestroyClip,
-    miCopyClip,
 };
 
 const GCOps	fbGCOps = {
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index 829200e..ae615be 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -54,9 +54,6 @@ static GCFuncs dmxGCFuncs = {
     dmxChangeGC,
     dmxCopyGC,
     dmxDestroyGC,
-    dmxChangeClip,
-    dmxDestroyClip,
-    dmxCopyClip,
 };
 
 static GCOps dmxGCOps = {
@@ -340,82 +337,3 @@ void dmxDestroyGC(GCPtr pGC)
     pGC->funcs->DestroyGC(pGC);
     DMX_GC_FUNC_EPILOGUE(pGC);
 }
-
-/** Change the clip rects for a GC. */
-void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
-{
-    ScreenPtr      pScreen = pGC->pScreen;
-    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-    dmxGCPrivPtr   pGCPriv = DMX_GET_GC_PRIV(pGC);
-    XRectangle    *pRects;
-    BoxPtr         pBox;
-    int            i, nRects;
-
-    DMX_GC_FUNC_PROLOGUE(pGC);
-    pGC->funcs->ChangeClip(pGC, type, pvalue, 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;
-
-    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);
-	}
-	break;
-
-    case CT_PIXMAP:
-    case CT_UNSORTED:
-    case CT_YSORTED:
-    case CT_YXSORTED:
-    case CT_YXBANDED:
-	/* These clip types are condensed down to either NONE or REGION
-           in the mi code */
-	break;
-    }
-
-    DMX_GC_FUNC_EPILOGUE(pGC);
-}
-
-/** Destroy a GC's clip rects. */
-void dmxDestroyClip(GCPtr pGC)
-{
-    ScreenPtr      pScreen = pGC->pScreen;
-    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
-    dmxGCPrivPtr   pGCPriv = DMX_GET_GC_PRIV(pGC);
-
-    DMX_GC_FUNC_PROLOGUE(pGC);
-    pGC->funcs->DestroyClip(pGC);
-
-    /* Set the client clip on the back-end server to None */
-    if (dmxScreen->beDisplay)
-	XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
-
-    DMX_GC_FUNC_EPILOGUE(pGC);
-}
-
-/** Copy a GC's clip rects. */
-void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
-{
-    DMX_GC_FUNC_PROLOGUE(pGCDst);
-    pGCDst->funcs->CopyClip(pGCDst, pGCSrc);
-    DMX_GC_FUNC_EPILOGUE(pGCDst);
-}
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index e518f45..78e9120 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -41,8 +41,7 @@
 
 static GCFuncs VGAarbiterGCFuncs = {
     VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
-    VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
-    VGAarbiterCopyClip
+    VGAarbiterDestroyGC,
 };
 
 static GCOps VGAarbiterGCOps = {
@@ -622,34 +621,6 @@ VGAarbiterCopyGC (
     GC_WRAP (pGCDst);
 }
 
-static void
-VGAarbiterChangeClip (
-    GCPtr   pGC,
-    int     type,
-    pointer pvalue,
-    int     nrects )
-{
-    GC_UNWRAP (pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    GC_WRAP (pGC);
-}
-
-static void
-VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    GC_UNWRAP (pgcDst);
-    (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
-    GC_WRAP (pgcDst);
-}
-
-static void
-VGAarbiterDestroyClip(GCPtr pGC)
-{
-    GC_UNWRAP (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    GC_WRAP (pGC);
-}
-
 /* GC Ops */
 static void
 VGAarbiterFillSpans(
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index 2920fb5..927bb69 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -182,10 +182,6 @@ static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
 static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
 static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void VGAarbiterDestroyGC(GCPtr pGC);
-static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
-    int nrects);
-static void VGAarbiterDestroyClip(GCPtr pGC);
-static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
 /* GC ops */
 static void VGAarbiterFillSpans( DrawablePtr pDraw, GC *pGC, int nInit,
diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c
index 5cc476a..499bbc3 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -359,13 +359,9 @@ static void ShadowValidateGC(GCPtr, unsigned long, DrawablePtr);
 static void ShadowChangeGC(GCPtr, unsigned long);
 static void ShadowCopyGC(GCPtr, unsigned long, GCPtr);
 static void ShadowDestroyGC(GCPtr);
-static void ShadowChangeClip(GCPtr, int, pointer, int);
-static void ShadowDestroyClip(GCPtr);
-static void ShadowCopyClip(GCPtr, GCPtr);
 
 GCFuncs ShadowGCFuncs = {
     ShadowValidateGC, ShadowChangeGC, ShadowCopyGC, ShadowDestroyGC,
-    ShadowChangeClip, ShadowDestroyClip, ShadowCopyClip
 };
 
 
@@ -436,37 +432,6 @@ ShadowCopyGC (
     SHADOW_GC_FUNC_EPILOGUE (pGCDst);
 }
 
-static void
-ShadowChangeClip (
-    GCPtr   pGC,
-    int		type,
-    pointer	pvalue,
-    int		nrects 
-){
-    SHADOW_GC_FUNC_PROLOGUE (pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    SHADOW_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-ShadowCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    SHADOW_GC_FUNC_PROLOGUE (pgcDst);
-    (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
-    SHADOW_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-ShadowDestroyClip(GCPtr pGC)
-{
-    SHADOW_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    SHADOW_GC_FUNC_EPILOGUE (pGC);
-}
-
-
-
-
 /**********************************************************/
 
 
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index 44d50e6..74eefb1 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -23,13 +23,9 @@ static void XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
 static void XAAChangeGC(GCPtr pGC, unsigned long mask);
 static void XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void XAADestroyGC(GCPtr pGC);
-static void XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
-static void XAADestroyClip(GCPtr pGC);
-static void XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
 GCFuncs XAAGCFuncs = {
     XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC,
-    XAAChangeClip, XAADestroyClip, XAACopyClip
 };
 
 extern GCOps XAAPixmapOps;
@@ -280,38 +276,9 @@ XAACopyGC (
     (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
     XAA_GC_FUNC_EPILOGUE (pGCDst);
 }
-static void
-XAAChangeClip (
-    GCPtr   pGC,
-    int		type,
-    pointer	pvalue,
-    int		nrects )
-{
-    XAA_GC_FUNC_PROLOGUE (pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    XAA_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    XAA_GC_FUNC_PROLOGUE (pgcDst);
-    (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
-    XAA_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-XAADestroyClip(GCPtr pGC)
-{
-    XAA_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    XAA_GC_FUNC_EPILOGUE (pGC);
-}
  
 /**** Pixmap Wrappers ****/
 
-
-
 static void
 XAAFillSpansPixmap(
     DrawablePtr pDraw,
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 7968b4f..9d3ec9d 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -42,9 +42,6 @@ static GCFuncs xnestFuncs = {
   xnestChangeGC,
   xnestCopyGC,
   xnestDestroyGC,
-  xnestChangeClip,
-  xnestDestroyClip,
-  xnestCopyClip,
 };
 
 static GCOps xnestOps = {
@@ -187,147 +184,3 @@ xnestDestroyGC(GCPtr pGC)
 {
   XFreeGC(xnestDisplay, xnestGC(pGC));
 }
-
-void
-xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
-{
-  int i, size;
-  BoxPtr pBox;
-  XRectangle *pRects;
-
-  xnestDestroyClipHelper(pGC);
-
-  switch(type) 
-    {
-    case CT_NONE:
-      XSetClipMask(xnestDisplay, xnestGC(pGC), None);
-      break;
-      
-    case CT_REGION:
-      nRects = RegionNumRects((RegionPtr)pValue);
-      size = nRects * sizeof(*pRects);
-      pRects = (XRectangle *) malloc(size);
-      pBox = RegionRects((RegionPtr)pValue);
-      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)pValue));
-      /*
-       * Need to change into region, so subsequent uses are with
-       * current pixmap contents.
-       */
-      pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pValue);
-      (*pGC->pScreen->DestroyPixmap)((PixmapPtr)pValue);
-      pValue = pGC->clientClip;
-      type = CT_REGION;
-      break;
-
-    case CT_UNSORTED:
-      XSetClipRectangles(xnestDisplay, xnestGC(pGC), 
-			 pGC->clipOrg.x, pGC->clipOrg.y,
-			 (XRectangle *)pValue, nRects, Unsorted);
-      break;
-
-    case CT_YSORTED:
-      XSetClipRectangles(xnestDisplay, xnestGC(pGC), 
-			 pGC->clipOrg.x, pGC->clipOrg.y,
-			 (XRectangle *)pValue, nRects, YSorted);
-      break;
-
-    case CT_YXSORTED:
-      XSetClipRectangles(xnestDisplay, xnestGC(pGC), 
-			 pGC->clipOrg.x, pGC->clipOrg.y,
-			 (XRectangle *)pValue, nRects, YXSorted);
-      break;
-
-    case CT_YXBANDED:
-      XSetClipRectangles(xnestDisplay, xnestGC(pGC), 
-			 pGC->clipOrg.x, pGC->clipOrg.y,
-			 (XRectangle *)pValue, nRects, YXBanded);
-      break;
-    }
-
-  switch(type) 
-    {
-    default:
-      break;
-
-    case CT_UNSORTED:
-    case CT_YSORTED:
-    case CT_YXSORTED:
-    case CT_YXBANDED:
-      
-      /*
-       * other parts of server can only deal with CT_NONE,
-       * CT_PIXMAP and CT_REGION client clips.
-       */
-      pGC->clientClip = (pointer) RegionFromRects(nRects,
-						  (xRectangle *)pValue, type);
-      free(pValue);
-      pValue = pGC->clientClip;
-      type = CT_REGION;
-
-      break;
-    }
-
-  pGC->clientClipType = type;
-  pGC->clientClip = pValue;
-  xnestGCPriv(pGC)->nClipRects = nRects;
-}
-
-void
-xnestDestroyClip(GCPtr pGC)
-{
-  xnestDestroyClipHelper(pGC);
-
-  XSetClipMask(xnestDisplay, xnestGC(pGC), None);
- 
-  pGC->clientClipType = CT_NONE;
-  pGC->clientClip = NULL;
-  xnestGCPriv(pGC)->nClipRects = 0;
-}
-
-void
-xnestDestroyClipHelper(GCPtr pGC)
-{
-  switch (pGC->clientClipType)
-    {
-    default:
-    case CT_NONE:
-      break;
-      
-    case CT_REGION:
-      RegionDestroy(pGC->clientClip);
-      break;
-    }
-}
-
-void
-xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
-{
-  RegionPtr pRgn;
-
-  switch (pGCSrc->clientClipType)
-    {
-    default:
-    case CT_NONE:
-      xnestDestroyClip(pGCDst);
-      break;
-
-    case CT_REGION:
-      pRgn = RegionCreate(NULL, 1);
-      RegionCopy(pRgn, pGCSrc->clientClip);
-      xnestChangeClip(pGCDst, CT_REGION, pRgn, 0);
-      break;
-    }
-}
diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h
index 9f10456..8693d20 100644
--- a/hw/xnest/XNGC.h
+++ b/hw/xnest/XNGC.h
@@ -35,9 +35,5 @@ void xnestValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
 void xnestChangeGC(GCPtr pGC, unsigned long mask);
 void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 void xnestDestroyGC(GCPtr pGC);
-void xnestChangeClip(GCPtr pGC, int type, pointer pValue, int nRects);
-void xnestDestroyClip(GCPtr pGC);
-void xnestDestroyClipHelper(GCPtr pGC);
-void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
 
 #endif /* XNESTGC_H */
diff --git a/hw/xwin/wingc.c b/hw/xwin/wingc.c
index e351c50..09e9968 100644
--- a/hw/xwin/wingc.c
+++ b/hw/xwin/wingc.c
@@ -60,26 +60,12 @@ static void
 winDestroyGCNativeGDI (GCPtr pGC);
 
 #if 0
-static void
-winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects);
-
-static void
-winDestroyClipNativeGDI (GCPtr pGC);
-
-static void
-winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc);
-#endif
-
-#if 0
 /* GC Handling Routines */
 const GCFuncs winGCFuncs = {
   winValidateGCNativeGDI,
   winChangeGCNativeGDI,
   winCopyGCNativeGDI,
   winDestroyGCNativeGDI,
-  winChangeClipNativeGDI,
-  winDestroyClipNativeGDI,
-  winCopyClipNativeGDI,
 };
 #else
 const GCFuncs winGCFuncs = {
@@ -87,9 +73,6 @@ const GCFuncs winGCFuncs = {
   miChangeGC,
   miCopyGC,
   winDestroyGCNativeGDI,
-  miChangeClip,
-  miDestroyClip,
-  miCopyClip,
 };
 #endif
 
@@ -224,28 +207,3 @@ winDestroyGCNativeGDI (GCPtr pGC)
   /* Invalidate the GC privates pointer */
   winSetGCPriv (pGC, NULL);
 }
-
-#if 0
-/* See Porting Layer Definition - p. 46 */
-static void
-winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects)
-{
-
-}
-
-
-/* See Porting Layer Definition - p. 47 */
-static void
-winDestroyClipNativeGDI (GCPtr pGC)
-{
-
-}
-
-
-/* See Porting Layer Definition - p. 47 */
-static void
-winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc)
-{
-
-}
-#endif
diff --git a/include/dix.h b/include/dix.h
index 7485e8e..4cb10ee 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -599,4 +599,22 @@ extern _X_EXPORT ClientPtr LookupClient(
     XID id,
     ClientPtr client);
 
+/* GC clip management */
+
+extern _X_EXPORT void DestroyClip(
+    GCPtr /*pGC*/
+);
+
+extern _X_EXPORT void ChangeClip(
+    GCPtr   /*pGC*/,
+    int     /*type*/,
+    pointer /*pvalue*/,
+    int     /*nrects*/
+);
+
+extern _X_EXPORT void CopyClip(
+    GCPtr /*pgcDst*/,
+    GCPtr /*pgcSrc*/
+);
+
 #endif /* DIX_H */
diff --git a/include/gcstruct.h b/include/gcstruct.h
index 767adac..933d477 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -82,19 +82,6 @@ typedef struct _GCFuncs {
 
     void	(* DestroyGC)(
 		GCPtr /*pGC*/);
-
-    void	(* ChangeClip)(
-		GCPtr /*pGC*/,
-		int /*type*/,
-		pointer /*pvalue*/,
-		int /*nrects*/);
-
-    void	(* DestroyClip)(
-		GCPtr /*pGC*/);
-
-    void	(* CopyClip)(
-		GCPtr /*pgcDst*/,
-		GCPtr /*pgcSrc*/);
 } GCFuncs;
 
 /*
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 49e17bd..c6e5816 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -443,7 +443,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
     prgnSrcClip = RegionCreate(NULL, 0);
     RegionCopy(prgnSrcClip, prgnSrc);
     RegionTranslate(prgnSrcClip, srcx, 0);
-    (*pGCT->funcs->ChangeClip)(pGCT, CT_REGION, prgnSrcClip, 0);
+    ChangeClip(pGCT, CT_REGION, prgnSrcClip, 0);
     ValidateGC((DrawablePtr)pPixmap, pGCT);
 
     /* Since we know pDraw is always a pixmap, we never need to think
@@ -528,7 +528,7 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
 
     ValidateGC(pDraw, pGC);
     /* put what we hope is a smaller clip region back in the scratch gc */
-    (*pGCT->funcs->ChangeClip)(pGCT, CT_NONE, NULL, 0);
+    ChangeClip(pGCT, CT_NONE, NULL, 0);
     FreeScratchGC(pGCT);
     (*pDraw->pScreen->DestroyPixmap)(pPixmap);
 
diff --git a/mi/migc.c b/mi/migc.c
index 6d734e1..dce1f30 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -53,76 +53,6 @@ miDestroyGC(GCPtr pGC)
 	RegionDestroy(pGC->pCompositeClip);
 }
 
-void
-miDestroyClip(GCPtr pGC)
-{
-    if (pGC->clientClipType == CT_NONE)
-	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);
-    }
-    pGC->clientClip = NULL;
-    pGC->clientClipType = CT_NONE;
-}
-
-void
-miChangeClip( GCPtr pGC, int type, pointer pvalue, int nrects)
-{
-    (*pGC->funcs->DestroyClip) (pGC);
-    if (type == CT_PIXMAP)
-    {
-	/* convert the pixmap to a region */
-	pGC->clientClip = (pointer) BitmapToRegion(pGC->pScreen,
-							(PixmapPtr) pvalue);
-	(*pGC->pScreen->DestroyPixmap) (pvalue);
-    }
-    else if (type == CT_REGION)
-    {
-	/* stuff the region in the GC */
-	pGC->clientClip = pvalue;
-    }
-    else if (type != CT_NONE)
-    {
-	pGC->clientClip = (pointer) RegionFromRects(nrects,
-						      (xRectangle *) pvalue,
-								    type);
-	free(pvalue);
-    }
-    pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION : CT_NONE;
-    pGC->stateChanges |= GCClipMask;
-}
-
-void
-miCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    RegionPtr       prgnNew;
-
-    switch (pgcSrc->clientClipType)
-    {
-      case CT_PIXMAP:
-	((PixmapPtr) pgcSrc->clientClip)->refcnt++;
-	/* Fall through !! */
-      case CT_NONE:
-	(*pgcDst->funcs->ChangeClip) (pgcDst, (int) pgcSrc->clientClipType,
-				   pgcSrc->clientClip, 0);
-	break;
-      case CT_REGION:
-	prgnNew = RegionCreate(NULL, 1);
-	RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
-	(*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (pointer) prgnNew, 0);
-	break;
-    }
-}
-
 /* ARGSUSED */
 void
 miCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
diff --git a/mi/migc.h b/mi/migc.h
index df5805f..c357ba7 100644
--- a/mi/migc.h
+++ b/mi/migc.h
@@ -26,7 +26,6 @@ from The Open Group.
 
 */
 
-
 extern _X_EXPORT void miChangeGC(
     GCPtr  /*pGC*/,
     unsigned long /*mask*/
@@ -36,22 +35,6 @@ extern _X_EXPORT void miDestroyGC(
     GCPtr  /*pGC*/
 );
 
-extern _X_EXPORT void miDestroyClip(
-    GCPtr /*pGC*/
-);
-
-extern _X_EXPORT void miChangeClip(
-    GCPtr   /*pGC*/,
-    int     /*type*/,
-    pointer /*pvalue*/,
-    int     /*nrects*/
-);
-
-extern _X_EXPORT void miCopyClip(
-    GCPtr /*pgcDst*/,
-    GCPtr /*pgcSrc*/
-);
-
 extern _X_EXPORT void miCopyGC(
     GCPtr /*pGCSrc*/,
     unsigned long /*changes*/,
diff --git a/miext/cw/cw.c b/miext/cw/cw.c
index 3da3bc3..94f3b0f 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -61,21 +61,12 @@ static void
 cwCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void
 cwDestroyGC(GCPtr pGC);
-static void
-cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
-static void
-cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
-static void
-cwDestroyClip(GCPtr pGC);
 
 GCFuncs cwGCFuncs = {
     cwValidateGC,
     cwChangeGC,
     cwCopyGC,
     cwDestroyGC,
-    cwChangeClip,
-    cwDestroyClip,
-    cwCopyClip,
 };
 
 /* Find the real drawable to draw to, and provide offsets that will translate
@@ -196,8 +187,7 @@ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable)
 	 * offset for it.
 	 */
 	
-	(*pBackingGC->funcs->ChangeClip) (pBackingGC, CT_REGION,
-					  (pointer) pCompositeClip, 0);
+	ChangeClip (pBackingGC, CT_REGION, pCompositeClip, 0);
 	
 	vals[0].val = x_off - pDrawable->x;
 	vals[1].val = y_off - pDrawable->y;
@@ -270,42 +260,6 @@ cwDestroyGC(GCPtr pGC)
     /* leave it unwrapped */
 }
 
-static void
-cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
-{
-    cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
-
-    FUNC_PROLOGUE(pGC, pPriv);
-
-    (*pGC->funcs->ChangeClip)(pGC, type, pvalue, nrects);
-
-    FUNC_EPILOGUE(pGC, pPriv);
-}
-
-static void
-cwCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pgcDst->devPrivates, cwGCKey);
-
-    FUNC_PROLOGUE(pgcDst, pPriv);
-
-    (*pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
-
-    FUNC_EPILOGUE(pgcDst, pPriv);
-}
-
-static void
-cwDestroyClip(GCPtr pGC)
-{
-    cwGCPtr pPriv = (cwGCPtr)dixLookupPrivate(&pGC->devPrivates, cwGCKey);
-
-    FUNC_PROLOGUE(pGC, pPriv);
-
-    (*pGC->funcs->DestroyClip)(pGC);
-
-    FUNC_EPILOGUE(pGC, pPriv);
-}
-
 /*
  * Screen wrappers.
  */
@@ -424,7 +378,7 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 			 -pBackingPixmap->screen_x,
 			 -pBackingPixmap->screen_y);
 	
-	(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
+	ChangeClip(pGC, CT_REGION, pClip, 0);
 
 	ValidateGC(&pBackingPixmap->drawable, pGC);
 
@@ -432,7 +386,7 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 			       &pBackingPixmap->drawable, pGC,
 			       src_x, src_y, w, h, dst_x, dst_y);
 
-	(*pGC->funcs->DestroyClip) (pGC);
+	DestroyClip(pGC);
 
 	FreeScratchGC(pGC);
     }
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index 21cbb78..b683f2c 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -427,13 +427,9 @@ static void damageValidateGC(GCPtr, unsigned long, DrawablePtr);
 static void damageChangeGC(GCPtr, unsigned long);
 static void damageCopyGC(GCPtr, unsigned long, GCPtr);
 static void damageDestroyGC(GCPtr);
-static void damageChangeClip(GCPtr, int, pointer, int);
-static void damageDestroyClip(GCPtr);
-static void damageCopyClip(GCPtr, GCPtr);
 
 static GCFuncs damageGCFuncs = {
     damageValidateGC, damageChangeGC, damageCopyGC, damageDestroyGC,
-    damageChangeClip, damageDestroyClip, damageCopyClip
 };
 
 static GCOps damageGCOps;
@@ -514,33 +510,6 @@ damageCopyGC (GCPtr	    pGCSrc,
     DAMAGE_GC_FUNC_EPILOGUE (pGCDst);
 }
 
-static void
-damageChangeClip (GCPtr	    pGC,
-		  int	    type,
-		  pointer   pvalue,
-		  int	    nrects)
-{
-    DAMAGE_GC_FUNC_PROLOGUE (pGC);
-    (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
-    DAMAGE_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-damageCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    DAMAGE_GC_FUNC_PROLOGUE (pgcDst);
-    (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
-    DAMAGE_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-damageDestroyClip(GCPtr pGC)
-{
-    DAMAGE_GC_FUNC_PROLOGUE (pGC);
-    (* pGC->funcs->DestroyClip)(pGC);
-    DAMAGE_GC_FUNC_EPILOGUE (pGC);
-}
-
 #define TRIM_BOX(box, pGC) if (pGC->pCompositeClip) { \
     BoxPtr extents = &pGC->pCompositeClip->extents;\
     if(box.x1 < extents->x1) box.x1 = extents->x1; \
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index 68a9dc7..93080c7 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -56,10 +56,6 @@ static void RootlessValidateGC(GCPtr pGC, unsigned long changes,
 static void RootlessChangeGC(GCPtr pGC, unsigned long mask);
 static void RootlessCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 static void RootlessDestroyGC(GCPtr pGC);
-static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue,
-                               int nrects);
-static void RootlessDestroyClip(GCPtr pGC);
-static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
 
 Bool RootlessCreateGC(GCPtr pGC);
 
@@ -68,9 +64,6 @@ GCFuncs rootlessGCFuncs = {
     RootlessChangeGC,
     RootlessCopyGC,
     RootlessDestroyGC,
-    RootlessChangeClip,
-    RootlessDestroyClip,
-    RootlessCopyClip,
 };
 
 // GC operations
@@ -371,28 +364,6 @@ static void RootlessDestroyGC(GCPtr pGC)
     GCFUNC_WRAP(pGC);
 }
 
-static void RootlessChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
-{
-    GCFUNC_UNWRAP(pGC);
-    pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
-    GCFUNC_WRAP(pGC);
-}
-
-static void RootlessDestroyClip(GCPtr pGC)
-{
-    GCFUNC_UNWRAP(pGC);
-    pGC->funcs->DestroyClip(pGC);
-    GCFUNC_WRAP(pGC);
-}
-
-static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    GCFUNC_UNWRAP(pgcDst);
-    pgcDst->funcs->CopyClip(pgcDst, pgcSrc);
-    GCFUNC_WRAP(pgcDst);
-}
-
-
 /*
  * GC ops
  *
diff --git a/render/mirect.c b/render/mirect.c
index 4fb347a..73a1651 100644
--- a/render/mirect.c
+++ b/render/mirect.c
@@ -66,7 +66,7 @@ miColorRects (PicturePtr    pDst,
 	pClip = RegionCreate(NULL, 1);
 	RegionCopy(pClip,
 		     (RegionPtr) pClipPict->clientClip);
-	(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
+	ChangeClip(pGC, CT_REGION, pClip, 0);
     }
 
     ChangeGC (NullClient, pGC, mask, tmpval);
diff --git a/xfixes/region.c b/xfixes/region.c
index 42d5d7c..8880da4 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -637,7 +637,7 @@ ProcXFixesSetGCClipRegion (ClientPtr client)
     vals[0].val = stuff->xOrigin;
     vals[1].val = stuff->yOrigin;
     ChangeGC (NullClient, pGC, GCClipXOrigin|GCClipYOrigin, vals);
-    (*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (pointer)pRegion, 0);
+    ChangeClip(pGC, pRegion ? CT_REGION : CT_NONE, pRegion, 0);
 
     return Success;
 }
-- 
1.7.3.1



More information about the xorg-devel mailing list