[PATCH 2/4] dix: Drop CopyClip from GCFuncs

Adam Jackson ajax at redhat.com
Mon Dec 5 10:56:15 PST 2011


Nobody was doing anything special with this.  Xnest had the most
complicated version, but it appears to be functionally equivalent to
miCopyClip.

Move miCopyClip to dix code and drop the slot from GCFuncs.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 Xext/panoramiX.c                       |   11 +----------
 dix/gc.c                               |   24 +++++++++++++++++++++++-
 exa/exa.c                              |   16 ----------------
 fb/fbgc.c                              |    1 -
 hw/dmx/dmxgc.c                         |    9 ---------
 hw/dmx/dmxgc.h                         |    1 -
 hw/xfree86/common/xf86VGAarbiter.c     |    9 ---------
 hw/xfree86/common/xf86VGAarbiterPriv.h |    1 -
 hw/xfree86/shadowfb/shadow.c           |   11 +----------
 hw/xfree86/xaa/xaaGC.c                 |   11 +----------
 hw/xnest/GC.c                          |   21 ---------------------
 hw/xnest/XNGC.h                        |    1 -
 hw/xwin/wingc.c                        |   11 -----------
 include/gcstruct.h                     |    4 ----
 mi/migc.c                              |   22 ----------------------
 mi/migc.h                              |    5 -----
 miext/cw/cw.c                          |   15 ---------------
 miext/damage/damage.c                  |   11 +----------
 miext/rootless/rootlessGC.c            |   10 ----------
 19 files changed, 27 insertions(+), 167 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index fae7c81..de4a38e 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -131,11 +131,10 @@ 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
+    XineramaChangeClip, XineramaDestroyClip,
 };
 
 #define Xinerama_GC_FUNC_PROLOGUE(pGC)\
@@ -312,14 +311,6 @@ XineramaChangeClip (
 }
 
 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);
diff --git a/dix/gc.c b/dix/gc.c
index fc251dd..693669b 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -605,6 +605,28 @@ CreateDefaultTile (GCPtr pGC)
     return TRUE;
 }
 
+static void
+doCopyClip(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;
+    }
+}
+
 int
 CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
 {
@@ -708,7 +730,7 @@ CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
 		pgcDst->clipOrg.y = pgcSrc->clipOrg.y;
 		break;
 	    case GCClipMask:
-		(* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+		doCopyClip(pgcDst, pgcSrc);
 		break;
 	    case GCDashOffset:
 		pgcDst->dashOffset = pgcSrc->dashOffset;
diff --git a/exa/exa.c b/exa/exa.c
index 4ce983b..beb3795 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -487,12 +487,6 @@ exaChangeClip (GCPtr pGC,
 		int nrects);
 
 static void
-exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
-
-static void
-exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
-
-static void
 exaDestroyClip(GCPtr pGC);
 
 const GCFuncs exaGCFuncs = {
@@ -502,7 +496,6 @@ const GCFuncs exaGCFuncs = {
     exaDestroyGC,
     exaChangeClip,
     exaDestroyClip,
-    exaCopyClip
 };
 
 static void
@@ -603,15 +596,6 @@ exaChangeClip (GCPtr pGC,
 }
 
 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);
diff --git a/fb/fbgc.c b/fb/fbgc.c
index 8108c3a..4f646cb 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -35,7 +35,6 @@ const GCFuncs fbGCFuncs = {
     miDestroyGC,
     miChangeClip,
     miDestroyClip,
-    miCopyClip,
 };
 
 const GCOps	fbGCOps = {
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index f10f9a0..a8830bd 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -56,7 +56,6 @@ static GCFuncs dmxGCFuncs = {
     dmxDestroyGC,
     dmxChangeClip,
     dmxDestroyClip,
-    dmxCopyClip,
 };
 
 static GCOps dmxGCOps = {
@@ -406,11 +405,3 @@ void dmxDestroyClip(GCPtr pGC)
 
     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/dmx/dmxgc.h b/hw/dmx/dmxgc.h
index 4ff3cd8..ac7daa7 100644
--- a/hw/dmx/dmxgc.h
+++ b/hw/dmx/dmxgc.h
@@ -58,7 +58,6 @@ extern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst);
 extern void dmxDestroyGC(GCPtr pGC);
 extern void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
 extern void dmxDestroyClip(GCPtr pGC);
-extern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
 
 extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC);
 extern Bool dmxBEFreeGC(GCPtr pGC);
diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
index 819ad6e..2d1781a 100644
--- a/hw/xfree86/common/xf86VGAarbiter.c
+++ b/hw/xfree86/common/xf86VGAarbiter.c
@@ -40,7 +40,6 @@
 static GCFuncs VGAarbiterGCFuncs = {
     VGAarbiterValidateGC, VGAarbiterChangeGC, VGAarbiterCopyGC,
     VGAarbiterDestroyGC, VGAarbiterChangeClip, VGAarbiterDestroyClip,
-    VGAarbiterCopyClip
 };
 
 static GCOps VGAarbiterGCOps = {
@@ -634,14 +633,6 @@ VGAarbiterChangeClip (
 }
 
 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);
diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h
index 848e45d..f4995fc 100644
--- a/hw/xfree86/common/xf86VGAarbiterPriv.h
+++ b/hw/xfree86/common/xf86VGAarbiterPriv.h
@@ -185,7 +185,6 @@ 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..acf41df 100644
--- a/hw/xfree86/shadowfb/shadow.c
+++ b/hw/xfree86/shadowfb/shadow.c
@@ -361,11 +361,10 @@ 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
+    ShadowChangeClip, ShadowDestroyClip,
 };
 
 
@@ -449,14 +448,6 @@ ShadowChangeClip (
 }
 
 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);
diff --git a/hw/xfree86/xaa/xaaGC.c b/hw/xfree86/xaa/xaaGC.c
index 44d50e6..384324c 100644
--- a/hw/xfree86/xaa/xaaGC.c
+++ b/hw/xfree86/xaa/xaaGC.c
@@ -25,11 +25,10 @@ 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
+    XAAChangeClip, XAADestroyClip,
 };
 
 extern GCOps XAAPixmapOps;
@@ -293,14 +292,6 @@ XAAChangeClip (
 }
 
 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);
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 48fe4dc..b22d8c6 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -44,7 +44,6 @@ static GCFuncs xnestFuncs = {
   xnestDestroyGC,
   xnestChangeClip,
   xnestDestroyClip,
-  xnestCopyClip,
 };
 
 static GCOps xnestOps = {
@@ -308,23 +307,3 @@ xnestDestroyClipHelper(GCPtr pGC)
       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 c4a6cef..c4cb329 100644
--- a/hw/xnest/XNGC.h
+++ b/hw/xnest/XNGC.h
@@ -37,6 +37,5 @@ 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..3737ec3 100644
--- a/hw/xwin/wingc.c
+++ b/hw/xwin/wingc.c
@@ -65,9 +65,6 @@ winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects);
 
 static void
 winDestroyClipNativeGDI (GCPtr pGC);
-
-static void
-winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc);
 #endif
 
 #if 0
@@ -79,7 +76,6 @@ const GCFuncs winGCFuncs = {
   winDestroyGCNativeGDI,
   winChangeClipNativeGDI,
   winDestroyClipNativeGDI,
-  winCopyClipNativeGDI,
 };
 #else
 const GCFuncs winGCFuncs = {
@@ -89,7 +85,6 @@ const GCFuncs winGCFuncs = {
   winDestroyGCNativeGDI,
   miChangeClip,
   miDestroyClip,
-  miCopyClip,
 };
 #endif
 
@@ -242,10 +237,4 @@ winDestroyClipNativeGDI (GCPtr pGC)
 }
 
 
-/* See Porting Layer Definition - p. 47 */
-static void
-winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc)
-{
-
-}
 #endif
diff --git a/include/gcstruct.h b/include/gcstruct.h
index 4fea02c..9e96778 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -91,10 +91,6 @@ typedef struct _GCFuncs {
 
     void	(* DestroyClip)(
 		GCPtr /*pGC*/);
-
-    void	(* CopyClip)(
-		GCPtr /*pgcDst*/,
-		GCPtr /*pgcSrc*/);
 } GCFuncs;
 
 /*
diff --git a/mi/migc.c b/mi/migc.c
index 6d734e1..e9cb512 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -101,28 +101,6 @@ miChangeClip( GCPtr pGC, int type, pointer pvalue, int nrects)
     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..038641e 100644
--- a/mi/migc.h
+++ b/mi/migc.h
@@ -47,11 +47,6 @@ extern _X_EXPORT void miChangeClip(
     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..fd6bc1b 100644
--- a/miext/cw/cw.c
+++ b/miext/cw/cw.c
@@ -64,8 +64,6 @@ 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 = {
@@ -75,7 +73,6 @@ GCFuncs cwGCFuncs = {
     cwDestroyGC,
     cwChangeClip,
     cwDestroyClip,
-    cwCopyClip,
 };
 
 /* Find the real drawable to draw to, and provide offsets that will translate
@@ -283,18 +280,6 @@ cwChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
 }
 
 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);
diff --git a/miext/damage/damage.c b/miext/damage/damage.c
index d791211..b88e7d0 100644
--- a/miext/damage/damage.c
+++ b/miext/damage/damage.c
@@ -385,11 +385,10 @@ 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
+    damageChangeClip, damageDestroyClip,
 };
 
 static GCOps damageGCOps;
@@ -482,14 +481,6 @@ damageChangeClip (GCPtr	    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);
diff --git a/miext/rootless/rootlessGC.c b/miext/rootless/rootlessGC.c
index 68a9dc7..e5885c1 100644
--- a/miext/rootless/rootlessGC.c
+++ b/miext/rootless/rootlessGC.c
@@ -59,7 +59,6 @@ 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);
 
@@ -70,7 +69,6 @@ GCFuncs rootlessGCFuncs = {
     RootlessDestroyGC,
     RootlessChangeClip,
     RootlessDestroyClip,
-    RootlessCopyClip,
 };
 
 // GC operations
@@ -385,14 +383,6 @@ static void RootlessDestroyClip(GCPtr pGC)
     GCFUNC_WRAP(pGC);
 }
 
-static void RootlessCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
-    GCFUNC_UNWRAP(pgcDst);
-    pgcDst->funcs->CopyClip(pgcDst, pgcSrc);
-    GCFUNC_WRAP(pgcDst);
-}
-
-
 /*
  * GC ops
  *
-- 
1.7.6.4



More information about the xorg-devel mailing list