xserver: Branch 'master' - 23 commits

Keith Packard keithp at kemper.freedesktop.org
Mon Oct 27 13:04:01 PDT 2014


 dix/gc.c                   |    3 
 exa/exa_accel.c            |   20 -
 exa/exa_priv.h             |    7 
 exa/exa_unaccel.c          |   11 
 fb/Makefile.am             |    2 
 fb/fb.h                    |  338 ------------------------
 fb/fbbits.c                |   12 
 fb/fbblt.c                 |  271 -------------------
 fb/fbbltone.c              |  314 +++++++++-------------
 fb/fbfill.c                |   84 ++++++
 fb/fbgc.c                  |   83 ------
 fb/fbglyph.c               |    8 
 fb/fbline.c                |    4 
 fb/fbpict.c                |   10 
 fb/fbpict.h                |    4 
 fb/fbpoint.c               |    2 
 fb/fbpush.c                |    4 
 fb/fbrop.h                 |   10 
 fb/fbseg.c                 |   22 -
 fb/fbstipple.c             |  264 -------------------
 fb/fbtile.c                |  163 -----------
 fb/fbutil.c                |  308 ----------------------
 fb/wfbrename.h             |   23 -
 hw/dmx/dmxgc.c             |   12 
 hw/kdrive/src/kxv.c        |    2 
 hw/xfree86/common/xf86xv.c |    2 
 hw/xfree86/sdksyms.sh      |    3 
 hw/xnest/GC.c              |   56 ----
 hw/xnest/XNGC.h            |    1 
 include/gcstruct.h         |   17 -
 mi/Makefile.am             |   11 
 mi/mi.h                    |   16 -
 mi/miarc.c                 |  205 ++++++++++++++
 mi/micopy.c                |    5 
 mi/micursor.c              |   68 ----
 mi/midash.c                |    1 
 mi/miexpose.c              |    2 
 mi/mifillarc.c             |    5 
 mi/mifillarc.h             |    9 
 mi/mifpoly.h               |   42 ---
 mi/mifpolycon.c            |  249 ------------------
 mi/migc.c                  |   45 ---
 mi/mioverlay.c             |    2 
 mi/mipointer.c             |   14 +
 mi/mipoly.c                |  619 ++++++++++++++++++++++++++++++++++++++++++++-
 mi/mipoly.h                |   20 -
 mi/mipolycon.c             |  235 -----------------
 mi/mipolygen.c             |  213 ---------------
 mi/mipolyutil.c            |  369 --------------------------
 mi/mispans.c               |  526 --------------------------------------
 mi/mispans.h               |   87 ------
 mi/miwideline.c            |  526 +++++++++++++++++++++++++++++++++++++-
 mi/miwideline.h            |   26 -
 xfixes/region.c            |   13 
 54 files changed, 1652 insertions(+), 3716 deletions(-)

New commits:
commit 839f05329ddb6f9b5b988edf3a2c3a1f856727f7
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Feb 28 16:35:10 2014 -0500

    dix: Retype and repack GC
    
    LP64: 160 bytes before, 128 after.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/include/gcstruct.h b/include/gcstruct.h
index 32e89a1..aa2064c 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -260,9 +260,9 @@ typedef struct _GC {
     unsigned int freeCompClip:1;        /* Free composite clip */
     unsigned int scratch_inuse:1;       /* is this GC in a pool for reuse? */
     unsigned int unused:15;     /* see comment above */
-    unsigned long planemask;
-    unsigned long fgPixel;
-    unsigned long bgPixel;
+    unsigned int planemask;
+    unsigned int fgPixel;
+    unsigned int bgPixel;
     /*
      * alas -- both tile and stipple must be here as they
      * are independently specifiable
@@ -270,11 +270,11 @@ typedef struct _GC {
     PixUnion tile;
     PixmapPtr stipple;
     DDXPointRec patOrg;         /* origin for (tile, stipple) */
-    struct _Font *font;
     DDXPointRec clipOrg;
+    struct _Font *font;
     RegionPtr clientClip;
-    unsigned long stateChanges; /* masked with GC_<kind> */
-    unsigned long serialNumber;
+    unsigned int stateChanges; /* masked with GC_<kind> */
+    unsigned int serialNumber;
     const GCFuncs *funcs;
     const GCOps *ops;
     PrivateRec *devPrivates;
commit 73e2383b7350723256894c5076d0c731aec5cd1f
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Jun 20 13:31:20 2014 -0400

    dix: Always store GC client clip as a region (v2)
    
    Again, this changes FixesCreateRegionFromGC to throw BadMatch when fed a
    GC with no client clip.
    
    v2: Fix Xnest and some variable names (Keith)
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/dix/gc.c b/dix/gc.c
index 88d6501..d10b7d6 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -495,7 +495,6 @@ NewGCObject(ScreenPtr pScreen, int depth)
     pGC->graphicsExposures = TRUE;
     pGC->clipOrg.x = 0;
     pGC->clipOrg.y = 0;
-    pGC->clientClipType = CT_NONE;
     pGC->clientClip = (void *) NULL;
     pGC->numInDashList = 2;
     pGC->dash = DefaultDash;
@@ -1067,7 +1066,7 @@ GetScratchGC(unsigned depth, ScreenPtr pScreen)
             pGC->graphicsExposures = FALSE;
             pGC->clipOrg.x = 0;
             pGC->clipOrg.y = 0;
-            if (pGC->clientClipType != CT_NONE)
+            if (pGC->clientClip)
                 (*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
             pGC->stateChanges = GCAllBits;
             return pGC;
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 9c742bd..5aa7d10 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -413,7 +413,7 @@ exaHWCopyNtoN(DrawablePtr pSrcDrawable,
 
         if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
                                            pGC->fillStyle, pGC->alu,
-                                           pGC->clientClipType)) {
+                                           pGC->clientClip != NULL)) {
             dstregion = RegionCreate(NullBox, 0);
             RegionCopy(dstregion, srcregion);
             RegionTranslate(dstregion, dst_off_x - dx - src_off_x,
@@ -771,7 +771,7 @@ exaPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
 
 static Bool exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion,
                                Pixel pixel, CARD32 planemask, CARD32 alu,
-                               unsigned int clientClipType);
+                               Bool hasClientClip);
 
 static void
 exaPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect)
@@ -816,11 +816,11 @@ exaPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrect, xRectangle *prect)
         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 != NULL)) ||
             (pGC->fillStyle == FillTiled && !pGC->tileIsPixel &&
              exaFillRegionTiled(pDrawable, pReg, pGC->tile.pixmap, &pGC->patOrg,
                                 pGC->planemask, pGC->alu,
-                                pGC->clientClipType))) {
+                                pGC->clientClip != NULL))) {
             goto out;
         }
     }
@@ -990,7 +990,7 @@ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
 
 static Bool
 exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
-                   CARD32 planemask, CARD32 alu, unsigned int clientClipType)
+                   CARD32 planemask, CARD32 alu, Bool hasClientClip)
 {
     ExaScreenPriv(pDrawable->pScreen);
     PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
@@ -1013,8 +1013,7 @@ exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
         pixmaps[0].pPix = pPixmap;
         pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillSolid,
                                                 alu,
-                                                clientClipType) ? NULL :
-            pRegion;
+                                                hasClientClip) ? NULL : pRegion;
 
         exaDoMigration(pixmaps, 1, TRUE);
     }
@@ -1074,7 +1073,7 @@ exaFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel,
 Bool
 exaFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
                    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
-                   unsigned int clientClipType)
+                   Bool hasClientClip)
 {
     ExaScreenPriv(pDrawable->pScreen);
     PixmapPtr pPixmap;
@@ -1096,7 +1095,7 @@ exaFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
     if (tileWidth == 1 && tileHeight == 1)
         return exaFillRegionSolid(pDrawable, pRegion,
                                   exaGetPixmapFirstPixel(pTile), planemask,
-                                  alu, clientClipType);
+                                  alu, hasClientClip);
 
     pPixmap = exaGetDrawablePixmap(pDrawable);
     pExaPixmap = ExaGetPixmapPriv(pPixmap);
@@ -1113,8 +1112,7 @@ exaFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
         pixmaps[0].pPix = pPixmap;
         pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask, FillTiled,
                                                 alu,
-                                                clientClipType) ? NULL :
-            pRegion;
+                                                hasClientClip) ? 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 88bfd37..ca4db72 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -455,12 +455,11 @@ ExaCheckAddTraps(PicturePtr pPicture,
 static _X_INLINE Bool
 exaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
                       unsigned int fillStyle, unsigned char alu,
-                      unsigned int clientClipType)
+                      Bool clientClip)
 {
     return ((alu != GXcopy && alu != GXclear && alu != GXset &&
              alu != GXcopyInverted) || fillStyle == FillStippled ||
-            clientClipType != CT_NONE ||
-            !EXA_PM_IS_SOLID(pDrawable, planemask));
+            clientClip != FALSE || !EXA_PM_IS_SOLID(pDrawable, planemask));
 }
 
 void
@@ -470,7 +469,7 @@ Bool
 
 exaFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
                    DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
-                   unsigned int clientClipType);
+                   Bool clientClip);
 
 void
 
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index b0c6344..73eada9 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -107,7 +107,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 != NULL))
         exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
     else
         pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST,
@@ -143,7 +143,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 != NULL) &&
         RegionInitBoxes(&reg, pbox, nbox)) {
         PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
 
@@ -179,10 +179,9 @@ ExaFallbackPrepareReg(DrawablePtr pDrawable,
     ExaScreenPriv(pScreen);
 
     if (pExaScr->prepare_access_reg &&
-        !(checkReads && exaGCReadsDestination(pDrawable,
-                                              pGC->planemask,
-                                              pGC->fillStyle,
-                                              pGC->alu, pGC->clientClipType))) {
+        !(checkReads && exaGCReadsDestination(pDrawable, pGC->planemask,
+                                              pGC->fillStyle, pGC->alu,
+                                              pGC->clientClip != NULL))) {
         BoxRec box;
         RegionRec reg;
         int xoff, yoff;
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index 2d61ea2..2343167 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -391,13 +391,10 @@ dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
     pGC->funcs->ChangeClip(pGC, type, pvalue, nrects);
 
     /* Set the client clip on the back-end server */
-    switch (pGC->clientClipType) {
-    case CT_NONE:
+    if (!pGC->clientClip) {
         if (dmxScreen->beDisplay)
             XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
-        break;
-
-    case CT_REGION:
+    } else {
         if (dmxScreen->beDisplay) {
             nRects = RegionNumRects((RegionPtr) pGC->clientClip);
             pRects = malloc(nRects * sizeof(*pRects));
@@ -416,11 +413,6 @@ dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
 
             free(pRects);
         }
-        break;
-
-    case CT_PIXMAP:
-        /* Condensed down to REGION in the mi code */
-        break;
     }
 
     DMX_GC_FUNC_EPILOGUE(pGC);
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 163d5c1..369db33 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -492,7 +492,7 @@ static void
 KdXVCopyClip(XvPortRecPrivatePtr portPriv, 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 5ef5de1..b974cd2 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -599,7 +599,7 @@ static void
 xf86XVCopyClip(XvPortRecPrivatePtr portPriv, 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/xnest/GC.c b/hw/xnest/GC.c
index 0ec60fc..96af6eb 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -194,11 +194,12 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
     BoxPtr pBox;
     XRectangle *pRects;
 
-    xnestDestroyClipHelper(pGC);
+    xnestDestroyClip(pGC);
 
     switch (type) {
     case CT_NONE:
         XSetClipMask(xnestDisplay, xnestGC(pGC), None);
+        pValue = NULL;
         break;
 
     case CT_REGION:
@@ -224,11 +225,9 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
          * Need to change into region, so subsequent uses are with
          * current pixmap contents.
          */
-        pGC->clientClip =
-            (void *) (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue);
+        pGC->clientClip = (*pGC->pScreen->BitmapToRegion) ((PixmapPtr) pValue);
         (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) pValue);
         pValue = pGC->clientClip;
-        type = CT_REGION;
         break;
 
     case CT_UNSORTED:
@@ -264,65 +263,34 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
     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 = (void *) RegionFromRects(nRects,
-                                                    (xRectangle *) pValue,
-                                                    type);
+        /* server clip representation is a region */
+        pGC->clientClip = RegionFromRects(nRects, (xRectangle *) pValue, type);
         free(pValue);
         pValue = pGC->clientClip;
-        type = CT_REGION;
-
         break;
     }
 
-    pGC->clientClipType = type;
     pGC->clientClip = pValue;
 }
 
 void
 xnestDestroyClip(GCPtr pGC)
 {
-    xnestDestroyClipHelper(pGC);
-
-    XSetClipMask(xnestDisplay, xnestGC(pGC), None);
-
-    pGC->clientClipType = CT_NONE;
-    pGC->clientClip = NULL;
-}
-
-void
-xnestDestroyClipHelper(GCPtr pGC)
-{
-    switch (pGC->clientClipType) {
-    default:
-    case CT_NONE:
-        break;
-
-    case CT_REGION:
+    if (pGC->clientClip) {
         RegionDestroy(pGC->clientClip);
-        break;
+        XSetClipMask(xnestDisplay, xnestGC(pGC), None);
+        pGC->clientClip = NULL;
     }
 }
 
 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);
+    if (pGCSrc->clientClip) {
+        RegionPtr pRgn = RegionCreate(NULL, 1);
         RegionCopy(pRgn, pGCSrc->clientClip);
         xnestChangeClip(pGCDst, CT_REGION, pRgn, 0);
-        break;
+    } else {
+        xnestDestroyClip(pGCDst);
     }
 }
diff --git a/hw/xnest/XNGC.h b/hw/xnest/XNGC.h
index e2f10fb..974173e 100644
--- a/hw/xnest/XNGC.h
+++ b/hw/xnest/XNGC.h
@@ -37,7 +37,6 @@ void xnestCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
 void xnestDestroyGC(GCPtr pGC);
 void xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects);
 void xnestDestroyClip(GCPtr pGC);
-void xnestDestroyClipHelper(GCPtr pGC);
 void xnestCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
 
 #endif                          /* XNESTGC_H */
diff --git a/include/gcstruct.h b/include/gcstruct.h
index 6358b8c..32e89a1 100644
--- a/include/gcstruct.h
+++ b/include/gcstruct.h
@@ -254,13 +254,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;
@@ -273,7 +272,7 @@ typedef struct _GC {
     DDXPointRec patOrg;         /* origin for (tile, stipple) */
     struct _Font *font;
     DDXPointRec clipOrg;
-    void *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 a52b0a7..2409c78 100644
--- a/mi/micopy.c
+++ b/mi/micopy.c
@@ -167,7 +167,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;
@@ -186,8 +186,7 @@ miDoCopy(DrawablePtr pSrcDrawable,
                  */
                 fastSrc = TRUE;
             }
-            else if ((pSrcDrawable == pDstDrawable) &&
-                     (pGC->clientClipType == CT_NONE)) {
+            else if ((pSrcDrawable == pDstDrawable) && (!pGC->clientClip)) {
                 prgnSrcClip = miGetCompositeClip(pGC);
             }
             else {
diff --git a/mi/miexpose.c b/mi/miexpose.c
index de8ee6c..e74b9c3 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -230,7 +230,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 9bbe884..8fdd481 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -55,20 +55,9 @@ miDestroyGC(GCPtr pGC)
 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
-         */
+    if (pGC->clientClip)
         RegionDestroy(pGC->clientClip);
-    }
     pGC->clientClip = NULL;
-    pGC->clientClipType = CT_NONE;
 }
 
 void
@@ -77,8 +66,7 @@ miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
     (*pGC->funcs->DestroyClip) (pGC);
     if (type == CT_PIXMAP) {
         /* convert the pixmap to a region */
-        pGC->clientClip = (void *) BitmapToRegion(pGC->pScreen,
-                                                   (PixmapPtr) pvalue);
+        pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue);
         (*pGC->pScreen->DestroyPixmap) (pvalue);
     }
     else if (type == CT_REGION) {
@@ -86,34 +74,21 @@ miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
         pGC->clientClip = pvalue;
     }
     else if (type != CT_NONE) {
-        pGC->clientClip = (void *) 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;
 }
 
 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);
+    if (pgcSrc->clientClip) {
+        RegionPtr prgnNew = RegionCreate(NULL, 1);
         RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
-        (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (void *) prgnNew, 0);
-        break;
+        (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, prgnNew, 0);
+    } else {
+        (*pgcDst->funcs->ChangeClip) (pgcDst, CT_NONE, NULL, 0);
     }
 }
 
@@ -149,7 +124,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);
             pGC->pCompositeClip = pregWin;
@@ -206,7 +181,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,
                                 pDrawable->x + pGC->clipOrg.x,
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index eb8dda1..2b20fd7 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -1667,7 +1667,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 4cfeee1..4492f12 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -222,20 +222,13 @@ ProcXFixesCreateRegionFromGC(ClientPtr client)
     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:
+    if (pGC->clientClip) {
         pClip = (RegionPtr) pGC->clientClip;
         pRegion = XFixesRegionCopy(pClip);
         if (!pRegion)
             return BadAlloc;
-        break;
-    default:
-        return BadImplementation;       /* assume sane server bits */
+    } else {
+        return BadMatch;
     }
 
     if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
commit e7b9295551d55b42b416ba70cce11dae79ece5e7
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep 26 13:41:59 2014 -0400

    fb: Hide fbPush{Pattern,Fill}
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fb.h b/fb/fb.h
index f6bceea..ab110f3 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1151,20 +1151,6 @@ fbPolyPoint(DrawablePtr pDrawable,
 /*
  * fbpush.c
  */
-extern _X_EXPORT void
-
-fbPushPattern(DrawablePtr pDrawable,
-              GCPtr pGC,
-              FbStip * src,
-              FbStride srcStride,
-              int srcX, int x, int y, int width, int height);
-
-extern _X_EXPORT void
-
-fbPushFill(DrawablePtr pDrawable,
-           GCPtr pGC,
-           FbStip * src,
-           FbStride srcStride, int srcX, int x, int y, int width, int height);
 
 extern _X_EXPORT void
 
diff --git a/fb/fbpush.c b/fb/fbpush.c
index f0a861c..1d1bcfd 100644
--- a/fb/fbpush.c
+++ b/fb/fbpush.c
@@ -26,7 +26,7 @@
 
 #include "fb.h"
 
-void
+static void
 fbPushPattern(DrawablePtr pDrawable,
               GCPtr pGC,
               FbStip * src,
@@ -84,7 +84,7 @@ fbPushPattern(DrawablePtr pDrawable,
     }
 }
 
-void
+static void
 fbPushFill(DrawablePtr pDrawable,
            GCPtr pGC,
            FbStip * src,
commit e31d16a82d83738740f67743b759c006d9845e79
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep 26 13:32:37 2014 -0400

    fb: Hide fbDots
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fb.h b/fb/fb.h
index a3d5185..f6bceea 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1145,16 +1145,6 @@ extern _X_EXPORT RegionPtr
 
 extern _X_EXPORT void
 
-fbDots(FbBits * dstOrig,
-       FbStride dstStride,
-       int dstBpp,
-       BoxPtr pBox,
-       xPoint * pts,
-       int npt,
-       int xorg, int yorg, int xoff, int yoff, FbBits andOrig, FbBits xorOrig);
-
-extern _X_EXPORT void
-
 fbPolyPoint(DrawablePtr pDrawable,
             GCPtr pGC, int mode, int npt, xPoint * pptInit);
 
diff --git a/fb/fbpoint.c b/fb/fbpoint.c
index d5129d7..be7c801 100644
--- a/fb/fbpoint.c
+++ b/fb/fbpoint.c
@@ -35,7 +35,7 @@ typedef void (*FbDots) (FbBits * dst,
                         int xorg,
                         int yorg, int xoff, int yoff, FbBits and, FbBits xor);
 
-void
+static void
 fbDots(FbBits * dstOrig,
        FbStride dstStride,
        int dstBpp,
commit 5db0f067ed4ff24c48cdb7998e4a52ad80037cb7
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep 26 13:30:06 2014 -0400

    fb: Hide Bresenham line details
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fb.h b/fb/fb.h
index 23e4c8d..a3d5185 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1268,34 +1268,20 @@ typedef void FbBres(DrawablePtr pDrawable,
                     int signdy,
                     int axis, int x, int y, int e, int e1, int e3, int len);
 
-extern _X_EXPORT FbBres fbBresSolid, fbBresDash, fbBresFill, fbBresFillDash;
+extern _X_EXPORT void
+fbSegment(DrawablePtr pDrawable,
+          GCPtr pGC,
+          int xa, int ya, int xb, int yb, Bool drawLast, int *dashOffset);
 
 /*
  * fbsetsp.c
  */
 
 extern _X_EXPORT void
-
 fbSetSpans(DrawablePtr pDrawable,
            GCPtr pGC,
            char *src, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
 
-extern _X_EXPORT FbBres *fbSelectBres(DrawablePtr pDrawable, GCPtr pGC);
-
-extern _X_EXPORT void
-
-fbBres(DrawablePtr pDrawable,
-       GCPtr pGC,
-       int dashOffset,
-       int signdx,
-       int signdy, int axis, int x, int y, int e, int e1, int e3, int len);
-
-extern _X_EXPORT void
-
-fbSegment(DrawablePtr pDrawable,
-          GCPtr pGC,
-          int xa, int ya, int xb, int yb, Bool drawLast, int *dashOffset);
-
 /*
  * fbsolid.c
  */
diff --git a/fb/fbseg.c b/fb/fbseg.c
index 1848387..36b17e3 100644
--- a/fb/fbseg.c
+++ b/fb/fbseg.c
@@ -33,7 +33,7 @@
 					((dir < 0) ? FbStipLeft(mask,bpp) : \
 					 FbStipRight(mask,bpp)))
 
-void
+static void
 fbBresSolid(DrawablePtr pDrawable,
             GCPtr pGC,
             int dashOffset,
@@ -103,7 +103,7 @@ fbBresSolid(DrawablePtr pDrawable,
     fbFinishAccess(pDrawable);
 }
 
-void
+static void
 fbBresDash(DrawablePtr pDrawable,
            GCPtr pGC,
            int dashOffset,
@@ -176,7 +176,7 @@ fbBresDash(DrawablePtr pDrawable,
     fbFinishAccess(pDrawable);
 }
 
-void
+static void
 fbBresFill(DrawablePtr pDrawable,
            GCPtr pGC,
            int dashOffset,
@@ -216,7 +216,7 @@ fbSetFg(DrawablePtr pDrawable, GCPtr pGC, Pixel fg)
     }
 }
 
-void
+static void
 fbBresFillDash(DrawablePtr pDrawable,
                GCPtr pGC,
                int dashOffset,
@@ -434,7 +434,7 @@ fbBresDash24RRop(DrawablePtr pDrawable,
  * based on the contents of the specified GC.
  */
 
-FbBres *
+static FbBres *
 fbSelectBres(DrawablePtr pDrawable, GCPtr pGC)
 {
     FbGCPrivPtr pPriv = fbGetGCPrivate(pGC);
@@ -494,18 +494,6 @@ fbSelectBres(DrawablePtr pDrawable, GCPtr pGC)
 }
 
 void
-fbBres(DrawablePtr pDrawable,
-       GCPtr pGC,
-       int dashOffset,
-       int signdx,
-       int signdy, int axis, int x1, int y1, int e, int e1, int e3, int len)
-{
-    (*fbSelectBres(pDrawable, pGC)) (pDrawable, pGC, dashOffset,
-                                     signdx, signdy, axis, x1, y1,
-                                     e, e1, e3, len);
-}
-
-void
 fbSegment(DrawablePtr pDrawable,
           GCPtr pGC,
           int x1, int y1, int x2, int y2, Bool drawLast, int *dashOffset)
commit b184a863c111834e28564d963c0733a30833f128
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 8 12:23:48 2014 -0400

    fb: Hide some zero-width line details
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fb.h b/fb/fb.h
index e567332..23e4c8d 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1098,15 +1098,6 @@ fbGetImage(DrawablePtr pDrawable,
  */
 
 extern _X_EXPORT void
-
-fbZeroLine(DrawablePtr pDrawable,
-           GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
-
-extern _X_EXPORT void
- fbZeroSegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs);
-
-extern _X_EXPORT void
-
 fbPolyLine(DrawablePtr pDrawable,
            GCPtr pGC, int mode, int npt, DDXPointPtr ppt);
 
diff --git a/fb/fbline.c b/fb/fbline.c
index 80dc89d..3e582e6 100644
--- a/fb/fbline.c
+++ b/fb/fbline.c
@@ -26,7 +26,7 @@
 
 #include "fb.h"
 
-void
+static void
 fbZeroLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
 {
     int x1, y1, x2, y2;
@@ -54,7 +54,7 @@ fbZeroLine(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt)
     }
 }
 
-void
+static void
 fbZeroSegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs)
 {
     int dashOffset;
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index adac64a..baa80f8 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -143,7 +143,5 @@
 #define fbUnrealizeFont wfbUnrealizeFont
 #define fbValidateGC wfbValidateGC
 #define fbWinPrivateKeyRec wfbWinPrivateKeyRec
-#define fbZeroLine wfbZeroLine
-#define fbZeroSegment wfbZeroSegment
 #define free_pixman_pict wfb_free_pixman_pict
 #define image_from_pict wfb_image_from_pict
commit 266cd552bd54fd3e7a83ae7178a303285857631e
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jul 8 12:13:13 2014 -0400

    fb: Hide glyph implementation details
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fb.h b/fb/fb.h
index 5099b0f..e567332 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -750,13 +750,6 @@ fbArc24(FbBits * dst,
         int dstBpp, xArc * arc, int dx, int dy, FbBits and, FbBits xor);
 
 extern _X_EXPORT void
-
-fbGlyph24(FbBits * dstLine,
-          FbStride dstStride,
-          int dstBpp, FbStip * stipple, FbBits fg, int height, int shift);
-
-extern _X_EXPORT void
-
 fbPolyline24(DrawablePtr pDrawable,
              GCPtr pGC, int mode, int npt, DDXPointPtr ptsOrig);
 
@@ -1045,9 +1038,6 @@ fbGetSpans(DrawablePtr pDrawable,
  * fbglyph.c
  */
 
-extern _X_EXPORT Bool
- fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height);
-
 extern _X_EXPORT void
 
 fbPolyGlyphBlt(DrawablePtr pDrawable,
diff --git a/fb/fbglyph.c b/fb/fbglyph.c
index 8484782..2f3bb8a 100644
--- a/fb/fbglyph.c
+++ b/fb/fbglyph.c
@@ -29,7 +29,7 @@
 #include	<X11/fonts/fontstruct.h>
 #include	"dixfontstr.h"
 
-Bool
+static Bool
 fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height)
 {
     BoxRec box;
@@ -116,7 +116,7 @@ fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height)
 #define CASE(a,b,c,d)	(a | (b << 1) | (c << 2) | (d << 3))
 #endif
 
-void
+static void
 fbGlyph24(FbBits * dstBits,
           FbStride dstStride,
           int dstBpp, FbStip * stipple, FbBits fg, int x, int height)
diff --git a/fb/fbpict.c b/fb/fbpict.c
index 7a9e46a..e726691 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -82,7 +82,7 @@ fbDestroyGlyphCache(void)
     }
 }
 
-void
+static void
 fbUnrealizeGlyph(ScreenPtr pScreen,
 		 GlyphPtr pGlyph)
 {
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 8b0f59f..5cb8663 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -72,10 +72,6 @@ fbTriangles(CARD8 op,
             INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris);
 
 extern _X_EXPORT void
-fbUnrealizeGlyph(ScreenPtr pScreen,
-		 GlyphPtr pGlyph);
-
-extern _X_EXPORT void
 fbGlyphs(CARD8 op,
 	 PicturePtr pSrc,
 	 PicturePtr pDst,
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index 30221c5..adac64a 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -74,7 +74,6 @@
 #define fbGlyph24 wfbGlyph24
 #define fbGlyph32 wfbGlyph32
 #define fbGlyph8 wfbGlyph8
-#define fbGlyphIn wfbGlyphIn
 #define fbHasVisualTypes wfbHasVisualTypes
 #define fbImageGlyphBlt wfbImageGlyphBlt
 #define fbIn wfbIn
commit e572bcc7f4236b7e0f23ab762f225b3bce37db59
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jun 23 15:24:35 2014 -0400

    fb: Remove even/odd tile slow-pathing
    
    Again, clearly meant to be a fast path, but this turns out not to be the
    case.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/Makefile.am b/fb/Makefile.am
index ff6dc3a..65b5d94 100644
--- a/fb/Makefile.am
+++ b/fb/Makefile.am
@@ -44,7 +44,6 @@ libfb_la_SOURCES = 	\
 	fbseg.c		\
 	fbsetsp.c	\
 	fbsolid.c	\
-	fbtile.c	\
 	fbtrap.c	\
 	fbutil.c	\
 	fbwindow.c
diff --git a/fb/fb.h b/fb/fb.h
index 9a67b9d..5099b0f 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1332,45 +1332,6 @@ fbSolid24(FbBits * dst,
           int dstX, int width, int height, FbBits and, FbBits xor);
 
 /*
- * fbtile.c
- */
-
-extern _X_EXPORT void
-
-fbEvenTile(FbBits * dst,
-           FbStride dstStride,
-           int dstX,
-           int width,
-           int height,
-           FbBits * tile,
-           FbStride tileStride,
-           int tileHeight, int alu, FbBits pm, int xRot, int yRot);
-
-extern _X_EXPORT void
-
-fbOddTile(FbBits * dst,
-          FbStride dstStride,
-          int dstX,
-          int width,
-          int height,
-          FbBits * tile,
-          FbStride tileStride,
-          int tileWidth,
-          int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
-
-extern _X_EXPORT void
-
-fbTile(FbBits * dst,
-       FbStride dstStride,
-       int dstX,
-       int width,
-       int height,
-       FbBits * tile,
-       FbStride tileStride,
-       int tileWidth,
-       int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot);
-
-/*
  * fbutil.c
  */
 extern _X_EXPORT FbBits fbReplicatePixel(Pixel p, int bpp);
diff --git a/fb/fbfill.c b/fb/fbfill.c
index ad09671..05d81ab 100644
--- a/fb/fbfill.c
+++ b/fb/fbfill.c
@@ -27,6 +27,44 @@
 #include "fb.h"
 
 static void
+fbTile(FbBits * dst, FbStride dstStride, int dstX, int width, int height,
+       FbBits * tile, FbStride tileStride, int tileWidth, int tileHeight,
+       int alu, FbBits pm, int bpp, int xRot, int yRot)
+{
+    int tileX, tileY;
+    int widthTmp;
+    int h, w;
+    int x, y;
+
+    modulus(-yRot, tileHeight, tileY);
+    y = 0;
+    while (height) {
+        h = tileHeight - tileY;
+        if (h > height)
+            h = height;
+        height -= h;
+        widthTmp = width;
+        x = dstX;
+        modulus(dstX - xRot, tileWidth, tileX);
+        while (widthTmp) {
+            w = tileWidth - tileX;
+            if (w > widthTmp)
+                w = widthTmp;
+            widthTmp -= w;
+            fbBlt(tile + tileY * tileStride,
+                  tileStride,
+                  tileX,
+                  dst + y * dstStride,
+                  dstStride, x, w, h, alu, pm, bpp, FALSE, FALSE);
+            x += w;
+            tileX = 0;
+        }
+        y += h;
+        tileY = 0;
+    }
+}
+
+static void
 fbStipple(FbBits * dst, FbStride dstStride,
           int dstX, int dstBpp,
           int width, int height,
diff --git a/fb/fbtile.c b/fb/fbtile.c
deleted file mode 100644
index 785c5f0..0000000
--- a/fb/fbtile.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-
-/*
- * Accelerated tile fill -- tile width is a power of two not greater
- * than FB_UNIT
- */
-
-void
-fbEvenTile(FbBits * dst,
-           FbStride dstStride,
-           int dstX,
-           int width,
-           int height,
-           FbBits * tile,
-           FbStride tileStride,
-           int tileHeight, int alu, FbBits pm, int xRot, int yRot)
-{
-    FbBits *t, *tileEnd, bits;
-    FbBits startmask, endmask;
-    FbBits and, xor;
-    int n, nmiddle;
-    int tileX, tileY;
-    int rot;
-    int startbyte, endbyte;
-
-    dst += dstX >> FB_SHIFT;
-    dstX &= FB_MASK;
-    FbMaskBitsBytes(dstX, width, FbDestInvarientRop(alu, pm),
-                    startmask, startbyte, nmiddle, endmask, endbyte);
-    if (startmask)
-        dstStride--;
-    dstStride -= nmiddle;
-
-    /*
-     * Compute tile start scanline and rotation parameters
-     */
-    tileEnd = tile + tileHeight * tileStride;
-    modulus(-yRot, tileHeight, tileY);
-    t = tile + tileY * tileStride;
-    modulus(-xRot, FB_UNIT, tileX);
-    rot = tileX;
-
-    while (height--) {
-
-        /*
-         * Pick up bits for this scanline
-         */
-        bits = READ(t);
-        t += tileStride;
-        if (t >= tileEnd)
-            t = tile;
-        bits = FbRotLeft(bits, rot);
-        and = fbAnd(alu, bits, pm);
-        xor = fbXor(alu, bits, pm);
-
-        if (startmask) {
-            FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
-            dst++;
-        }
-        n = nmiddle;
-        if (!and)
-            while (n--)
-                WRITE(dst++, xor);
-        else
-            while (n--) {
-                WRITE(dst, FbDoRRop(READ(dst), and, xor));
-                dst++;
-            }
-        if (endmask)
-            FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
-        dst += dstStride;
-    }
-}
-
-void
-fbOddTile(FbBits * dst,
-          FbStride dstStride,
-          int dstX,
-          int width,
-          int height,
-          FbBits * tile,
-          FbStride tileStride,
-          int tileWidth,
-          int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot)
-{
-    int tileX, tileY;
-    int widthTmp;
-    int h, w;
-    int x, y;
-
-    modulus(-yRot, tileHeight, tileY);
-    y = 0;
-    while (height) {
-        h = tileHeight - tileY;
-        if (h > height)
-            h = height;
-        height -= h;
-        widthTmp = width;
-        x = dstX;
-        modulus(dstX - xRot, tileWidth, tileX);
-        while (widthTmp) {
-            w = tileWidth - tileX;
-            if (w > widthTmp)
-                w = widthTmp;
-            widthTmp -= w;
-            fbBlt(tile + tileY * tileStride,
-                  tileStride,
-                  tileX,
-                  dst + y * dstStride,
-                  dstStride, x, w, h, alu, pm, bpp, FALSE, FALSE);
-            x += w;
-            tileX = 0;
-        }
-        y += h;
-        tileY = 0;
-    }
-}
-
-void
-fbTile(FbBits * dst,
-       FbStride dstStride,
-       int dstX,
-       int width,
-       int height,
-       FbBits * tile,
-       FbStride tileStride,
-       int tileWidth,
-       int tileHeight, int alu, FbBits pm, int bpp, int xRot, int yRot)
-{
-    if (FbEvenTile(tileWidth))
-        fbEvenTile(dst, dstStride, dstX, width, height,
-                   tile, tileStride, tileHeight, alu, pm, xRot, yRot);
-    else
-        fbOddTile(dst, dstStride, dstX, width, height,
-                  tile, tileStride, tileWidth, tileHeight,
-                  alu, pm, bpp, xRot, yRot);
-}
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index d32c7a4..30221c5 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -58,7 +58,6 @@
 #define fbDots24 wfbDots24
 #define fbDots32 wfbDots32
 #define fbDots8 wfbDots8
-#define fbEvenTile wfbEvenTile
 #define fbExpandDirectColors wfbExpandDirectColors
 #define fbFill wfbFill
 #define fbFillRegionSolid wfbFillRegionSolid
@@ -83,7 +82,6 @@
 #define fbInitVisuals wfbInitVisuals
 #define fbListInstalledColormaps wfbListInstalledColormaps
 #define FbMergeRopBits wFbMergeRopBits
-#define fbOddTile wfbOddTile
 #define fbOver wfbOver
 #define fbOver24 wfbOver24
 #define fbOverlayCloseScreen wfbOverlayCloseScreen
@@ -139,7 +137,6 @@
 #define fbSolid wfbSolid
 #define fbSolid24 wfbSolid24
 #define fbSolidBoxClipped wfbSolidBoxClipped
-#define fbTile wfbTile
 #define fbTrapezoids wfbTrapezoids
 #define fbTriangles wfbTriangles
 #define fbUninstallColormap wfbUninstallColormap
commit 836bb27726441e048bb300664343a136bc596a5b
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 17 12:25:42 2014 -0400

    fb: Remove unused fbReduceRasterOp
    
    Appears to have been cargo-culted in from cfb and then never used.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fb.h b/fb/fb.h
index f7cbaf9..9a67b9d 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -1375,9 +1375,6 @@ fbTile(FbBits * dst,
  */
 extern _X_EXPORT FbBits fbReplicatePixel(Pixel p, int bpp);
 
-extern _X_EXPORT void
- fbReduceRasterOp(int rop, FbBits fg, FbBits pm, FbBits * andp, FbBits * xorp);
-
 #ifdef FB_ACCESS_WRAPPER
 extern _X_EXPORT ReadMemoryProcPtr wfbReadMemory;
 extern _X_EXPORT WriteMemoryProcPtr wfbWriteMemory;
diff --git a/fb/fbutil.c b/fb/fbutil.c
index 078fc42..c1d5923 100644
--- a/fb/fbutil.c
+++ b/fb/fbutil.c
@@ -39,84 +39,6 @@ fbReplicatePixel(Pixel p, int bpp)
     return b;
 }
 
-void
-fbReduceRasterOp(int rop, FbBits fg, FbBits pm, FbBits * andp, FbBits * xorp)
-{
-    FbBits and, xor;
-
-    switch (rop) {
-    default:
-    case GXclear:              /* 0 0 0 0 */
-        and = 0;
-        xor = 0;
-        break;
-    case GXand:                /* 0 0 0 1 */
-        and = fg;
-        xor = 0;
-        break;
-    case GXandReverse:         /* 0 0 1 0 */
-        and = fg;
-        xor = fg;
-        break;
-    case GXcopy:               /* 0 0 1 1 */
-        and = 0;
-        xor = fg;
-        break;
-    case GXandInverted:        /* 0 1 0 0 */
-        and = ~fg;
-        xor = 0;
-        break;
-    case GXnoop:               /* 0 1 0 1 */
-        and = FB_ALLONES;
-        xor = 0;
-        break;
-    case GXxor:                /* 0 1 1 0 */
-        and = FB_ALLONES;
-        xor = fg;
-        break;
-    case GXor:                 /* 0 1 1 1 */
-        and = ~fg;
-        xor = fg;
-        break;
-    case GXnor:                /* 1 0 0 0 */
-        and = ~fg;
-        xor = ~fg;
-        break;
-    case GXequiv:              /* 1 0 0 1 */
-        and = FB_ALLONES;
-        xor = ~fg;
-        break;
-    case GXinvert:             /* 1 0 1 0 */
-        and = FB_ALLONES;
-        xor = FB_ALLONES;
-        break;
-    case GXorReverse:          /* 1 0 1 1 */
-        and = ~fg;
-        xor = FB_ALLONES;
-        break;
-    case GXcopyInverted:       /* 1 1 0 0 */
-        and = 0;
-        xor = ~fg;
-        break;
-    case GXorInverted:         /* 1 1 0 1 */
-        and = fg;
-        xor = ~fg;
-        break;
-    case GXnand:               /* 1 1 1 0 */
-        and = fg;
-        xor = FB_ALLONES;
-        break;
-    case GXset:                /* 1 1 1 1 */
-        and = 0;
-        xor = FB_ALLONES;
-        break;
-    }
-    and |= ~pm;
-    xor &= pm;
-    *andp = and;
-    *xorp = xor;
-}
-
 #define O 0
 #define I FB_ALLONES
 
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index c8be10f..d32c7a4 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -126,8 +126,6 @@
 #define fbQueryBestSize wfbQueryBestSize
 #define fbRasterizeTrapezoid wfbRasterizeTrapezoid
 #define fbRealizeFont wfbRealizeFont
-#define fbRealizeWindow wfbRealizeWindow
-#define fbReduceRasterOp wfbReduceRasterOp
 #define fbReplicatePixel wfbReplicatePixel
 #define fbResolveColor wfbResolveColor
 #define fbScreenPrivateKeyRec wfbScreenPrivateKeyRec
commit 167ccd33e0d2c4bd68aebcdba5a512d24c5eb49a
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 17 12:21:19 2014 -0400

    fb: Move fbStipple*Bits near their only consumer
    
    And remove fbStippleTable since gcc can't figure that out itself.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index bd3229a..d5806e5 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -26,6 +26,101 @@
 
 #include "fb.h"
 
+/*
+ * Stipple masks are independent of bit/byte order as long
+ * as bitorder == byteorder.  FB doesn't handle the case
+ * where these differ
+ */
+#define BitsMask(x,w)	((FB_ALLONES << ((x) & FB_MASK)) & \
+			 (FB_ALLONES >> ((FB_UNIT - ((x) + (w))) & FB_MASK)))
+
+#define Mask(x,w)	BitsMask((x)*(w),(w))
+
+#define SelMask(b,n,w)	((((b) >> n) & 1) * Mask(n,w))
+
+#define C1(b,w) \
+    (SelMask(b,0,w))
+
+#define C2(b,w) \
+    (SelMask(b,0,w) | \
+     SelMask(b,1,w))
+
+#define C4(b,w) \
+    (SelMask(b,0,w) | \
+     SelMask(b,1,w) | \
+     SelMask(b,2,w) | \
+     SelMask(b,3,w))
+
+#define C8(b,w) \
+    (SelMask(b,0,w) | \
+     SelMask(b,1,w) | \
+     SelMask(b,2,w) | \
+     SelMask(b,3,w) | \
+     SelMask(b,4,w) | \
+     SelMask(b,5,w) | \
+     SelMask(b,6,w) | \
+     SelMask(b,7,w))
+
+static const FbBits fbStipple8Bits[256] = {
+    C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4),
+    C8(6, 4), C8(7, 4), C8(8, 4), C8(9, 4), C8(10, 4), C8(11, 4),
+    C8(12, 4), C8(13, 4), C8(14, 4), C8(15, 4), C8(16, 4), C8(17, 4),
+    C8(18, 4), C8(19, 4), C8(20, 4), C8(21, 4), C8(22, 4), C8(23, 4),
+    C8(24, 4), C8(25, 4), C8(26, 4), C8(27, 4), C8(28, 4), C8(29, 4),
+    C8(30, 4), C8(31, 4), C8(32, 4), C8(33, 4), C8(34, 4), C8(35, 4),
+    C8(36, 4), C8(37, 4), C8(38, 4), C8(39, 4), C8(40, 4), C8(41, 4),
+    C8(42, 4), C8(43, 4), C8(44, 4), C8(45, 4), C8(46, 4), C8(47, 4),
+    C8(48, 4), C8(49, 4), C8(50, 4), C8(51, 4), C8(52, 4), C8(53, 4),
+    C8(54, 4), C8(55, 4), C8(56, 4), C8(57, 4), C8(58, 4), C8(59, 4),
+    C8(60, 4), C8(61, 4), C8(62, 4), C8(63, 4), C8(64, 4), C8(65, 4),
+    C8(66, 4), C8(67, 4), C8(68, 4), C8(69, 4), C8(70, 4), C8(71, 4),
+    C8(72, 4), C8(73, 4), C8(74, 4), C8(75, 4), C8(76, 4), C8(77, 4),
+    C8(78, 4), C8(79, 4), C8(80, 4), C8(81, 4), C8(82, 4), C8(83, 4),
+    C8(84, 4), C8(85, 4), C8(86, 4), C8(87, 4), C8(88, 4), C8(89, 4),
+    C8(90, 4), C8(91, 4), C8(92, 4), C8(93, 4), C8(94, 4), C8(95, 4),
+    C8(96, 4), C8(97, 4), C8(98, 4), C8(99, 4), C8(100, 4), C8(101, 4),
+    C8(102, 4), C8(103, 4), C8(104, 4), C8(105, 4), C8(106, 4), C8(107, 4),
+    C8(108, 4), C8(109, 4), C8(110, 4), C8(111, 4), C8(112, 4), C8(113, 4),
+    C8(114, 4), C8(115, 4), C8(116, 4), C8(117, 4), C8(118, 4), C8(119, 4),
+    C8(120, 4), C8(121, 4), C8(122, 4), C8(123, 4), C8(124, 4), C8(125, 4),
+    C8(126, 4), C8(127, 4), C8(128, 4), C8(129, 4), C8(130, 4), C8(131, 4),
+    C8(132, 4), C8(133, 4), C8(134, 4), C8(135, 4), C8(136, 4), C8(137, 4),
+    C8(138, 4), C8(139, 4), C8(140, 4), C8(141, 4), C8(142, 4), C8(143, 4),
+    C8(144, 4), C8(145, 4), C8(146, 4), C8(147, 4), C8(148, 4), C8(149, 4),
+    C8(150, 4), C8(151, 4), C8(152, 4), C8(153, 4), C8(154, 4), C8(155, 4),
+    C8(156, 4), C8(157, 4), C8(158, 4), C8(159, 4), C8(160, 4), C8(161, 4),
+    C8(162, 4), C8(163, 4), C8(164, 4), C8(165, 4), C8(166, 4), C8(167, 4),
+    C8(168, 4), C8(169, 4), C8(170, 4), C8(171, 4), C8(172, 4), C8(173, 4),
+    C8(174, 4), C8(175, 4), C8(176, 4), C8(177, 4), C8(178, 4), C8(179, 4),
+    C8(180, 4), C8(181, 4), C8(182, 4), C8(183, 4), C8(184, 4), C8(185, 4),
+    C8(186, 4), C8(187, 4), C8(188, 4), C8(189, 4), C8(190, 4), C8(191, 4),
+    C8(192, 4), C8(193, 4), C8(194, 4), C8(195, 4), C8(196, 4), C8(197, 4),
+    C8(198, 4), C8(199, 4), C8(200, 4), C8(201, 4), C8(202, 4), C8(203, 4),
+    C8(204, 4), C8(205, 4), C8(206, 4), C8(207, 4), C8(208, 4), C8(209, 4),
+    C8(210, 4), C8(211, 4), C8(212, 4), C8(213, 4), C8(214, 4), C8(215, 4),
+    C8(216, 4), C8(217, 4), C8(218, 4), C8(219, 4), C8(220, 4), C8(221, 4),
+    C8(222, 4), C8(223, 4), C8(224, 4), C8(225, 4), C8(226, 4), C8(227, 4),
+    C8(228, 4), C8(229, 4), C8(230, 4), C8(231, 4), C8(232, 4), C8(233, 4),
+    C8(234, 4), C8(235, 4), C8(236, 4), C8(237, 4), C8(238, 4), C8(239, 4),
+    C8(240, 4), C8(241, 4), C8(242, 4), C8(243, 4), C8(244, 4), C8(245, 4),
+    C8(246, 4), C8(247, 4), C8(248, 4), C8(249, 4), C8(250, 4), C8(251, 4),
+    C8(252, 4), C8(253, 4), C8(254, 4), C8(255, 4),
+};
+
+static const FbBits fbStipple4Bits[16] = {
+    C4(0, 8), C4(1, 8), C4(2, 8), C4(3, 8), C4(4, 8), C4(5, 8),
+    C4(6, 8), C4(7, 8), C4(8, 8), C4(9, 8), C4(10, 8), C4(11, 8),
+    C4(12, 8), C4(13, 8), C4(14, 8), C4(15, 8),
+};
+
+static const FbBits fbStipple2Bits[4] = {
+    C2(0, 16), C2(1, 16), C2(2, 16), C2(3, 16),
+};
+
+static const FbBits fbStipple1Bits[2] = {
+    C1(0, 32), C1(1, 32),
+};
+
 #ifdef __clang__
 /* shift overflow is intentional */
 #pragma clang diagnostic ignored "-Wshift-overflow"
@@ -153,8 +248,22 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
      * Get pointer to stipple mask array for this depth
      */
     fbBits = 0;                 /* unused */
-    if (pixelsPerDst <= 8)
-        fbBits = fbStippleTable[pixelsPerDst];
+    switch (pixelsPerDst) {
+    case 8:
+        fbBits = fbStipple8Bits;
+        break;
+    case 4:
+        fbBits = fbStipple4Bits;
+        break;
+    case 2:
+        fbBits = fbStipple2Bits;
+        break;
+    case 1:
+        fbBits = fbStipple1Bits;
+        break;
+    default:
+        return;
+    }
 
     /*
      * Compute total number of destination words written, but 
diff --git a/fb/fbrop.h b/fb/fbrop.h
index b995f23..872ae52 100644
--- a/fb/fbrop.h
+++ b/fb/fbrop.h
@@ -95,12 +95,6 @@ extern _X_EXPORT const FbMergeRopRec FbMergeRopBits[16];
  * Stippling operations; 
  */
 
-extern _X_EXPORT const FbBits fbStipple8Bits[256];
-extern _X_EXPORT const FbBits fbStipple4Bits[16];
-extern _X_EXPORT const FbBits fbStipple2Bits[4];
-extern _X_EXPORT const FbBits fbStipple1Bits[2];
-extern _X_EXPORT const FbBits *const fbStippleTable[];
-
 #define FbStippleRRop(dst, b, fa, fx, ba, bx) \
     (FbDoRRop(dst, fa, fx) & b) | (FbDoRRop(dst, ba, bx) & ~b)
 
diff --git a/fb/fbutil.c b/fb/fbutil.c
index 9d66c2a..078fc42 100644
--- a/fb/fbutil.c
+++ b/fb/fbutil.c
@@ -139,110 +139,3 @@ const FbMergeRopRec FbMergeRopBits[16] = {
     {O, O, O, I},               /* set           0xf         1 */
 };
 
-/*
- * Stipple masks are independent of bit/byte order as long
- * as bitorder == byteorder.  FB doesn't handle the case
- * where these differ
- */
-#define BitsMask(x,w)	((FB_ALLONES << ((x) & FB_MASK)) & \
-			 (FB_ALLONES >> ((FB_UNIT - ((x) + (w))) & FB_MASK)))
-
-#define Mask(x,w)	BitsMask((x)*(w),(w))
-
-#define SelMask(b,n,w)	((((b) >> n) & 1) * Mask(n,w))
-
-#define C1(b,w) \
-    (SelMask(b,0,w))
-
-#define C2(b,w) \
-    (SelMask(b,0,w) | \
-     SelMask(b,1,w))
-
-#define C4(b,w) \
-    (SelMask(b,0,w) | \
-     SelMask(b,1,w) | \
-     SelMask(b,2,w) | \
-     SelMask(b,3,w))
-
-#define C8(b,w) \
-    (SelMask(b,0,w) | \
-     SelMask(b,1,w) | \
-     SelMask(b,2,w) | \
-     SelMask(b,3,w) | \
-     SelMask(b,4,w) | \
-     SelMask(b,5,w) | \
-     SelMask(b,6,w) | \
-     SelMask(b,7,w))
-
-#define fbStipple16Bits 0
-const FbBits fbStipple8Bits[256] = {
-    C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4),
-    C8(6, 4), C8(7, 4), C8(8, 4), C8(9, 4), C8(10, 4), C8(11, 4),
-    C8(12, 4), C8(13, 4), C8(14, 4), C8(15, 4), C8(16, 4), C8(17, 4),
-    C8(18, 4), C8(19, 4), C8(20, 4), C8(21, 4), C8(22, 4), C8(23, 4),
-    C8(24, 4), C8(25, 4), C8(26, 4), C8(27, 4), C8(28, 4), C8(29, 4),
-    C8(30, 4), C8(31, 4), C8(32, 4), C8(33, 4), C8(34, 4), C8(35, 4),
-    C8(36, 4), C8(37, 4), C8(38, 4), C8(39, 4), C8(40, 4), C8(41, 4),
-    C8(42, 4), C8(43, 4), C8(44, 4), C8(45, 4), C8(46, 4), C8(47, 4),
-    C8(48, 4), C8(49, 4), C8(50, 4), C8(51, 4), C8(52, 4), C8(53, 4),
-    C8(54, 4), C8(55, 4), C8(56, 4), C8(57, 4), C8(58, 4), C8(59, 4),
-    C8(60, 4), C8(61, 4), C8(62, 4), C8(63, 4), C8(64, 4), C8(65, 4),
-    C8(66, 4), C8(67, 4), C8(68, 4), C8(69, 4), C8(70, 4), C8(71, 4),
-    C8(72, 4), C8(73, 4), C8(74, 4), C8(75, 4), C8(76, 4), C8(77, 4),
-    C8(78, 4), C8(79, 4), C8(80, 4), C8(81, 4), C8(82, 4), C8(83, 4),
-    C8(84, 4), C8(85, 4), C8(86, 4), C8(87, 4), C8(88, 4), C8(89, 4),
-    C8(90, 4), C8(91, 4), C8(92, 4), C8(93, 4), C8(94, 4), C8(95, 4),
-    C8(96, 4), C8(97, 4), C8(98, 4), C8(99, 4), C8(100, 4), C8(101, 4),
-    C8(102, 4), C8(103, 4), C8(104, 4), C8(105, 4), C8(106, 4), C8(107, 4),
-    C8(108, 4), C8(109, 4), C8(110, 4), C8(111, 4), C8(112, 4), C8(113, 4),
-    C8(114, 4), C8(115, 4), C8(116, 4), C8(117, 4), C8(118, 4), C8(119, 4),
-    C8(120, 4), C8(121, 4), C8(122, 4), C8(123, 4), C8(124, 4), C8(125, 4),
-    C8(126, 4), C8(127, 4), C8(128, 4), C8(129, 4), C8(130, 4), C8(131, 4),
-    C8(132, 4), C8(133, 4), C8(134, 4), C8(135, 4), C8(136, 4), C8(137, 4),
-    C8(138, 4), C8(139, 4), C8(140, 4), C8(141, 4), C8(142, 4), C8(143, 4),
-    C8(144, 4), C8(145, 4), C8(146, 4), C8(147, 4), C8(148, 4), C8(149, 4),
-    C8(150, 4), C8(151, 4), C8(152, 4), C8(153, 4), C8(154, 4), C8(155, 4),
-    C8(156, 4), C8(157, 4), C8(158, 4), C8(159, 4), C8(160, 4), C8(161, 4),
-    C8(162, 4), C8(163, 4), C8(164, 4), C8(165, 4), C8(166, 4), C8(167, 4),
-    C8(168, 4), C8(169, 4), C8(170, 4), C8(171, 4), C8(172, 4), C8(173, 4),
-    C8(174, 4), C8(175, 4), C8(176, 4), C8(177, 4), C8(178, 4), C8(179, 4),
-    C8(180, 4), C8(181, 4), C8(182, 4), C8(183, 4), C8(184, 4), C8(185, 4),
-    C8(186, 4), C8(187, 4), C8(188, 4), C8(189, 4), C8(190, 4), C8(191, 4),
-    C8(192, 4), C8(193, 4), C8(194, 4), C8(195, 4), C8(196, 4), C8(197, 4),
-    C8(198, 4), C8(199, 4), C8(200, 4), C8(201, 4), C8(202, 4), C8(203, 4),
-    C8(204, 4), C8(205, 4), C8(206, 4), C8(207, 4), C8(208, 4), C8(209, 4),
-    C8(210, 4), C8(211, 4), C8(212, 4), C8(213, 4), C8(214, 4), C8(215, 4),
-    C8(216, 4), C8(217, 4), C8(218, 4), C8(219, 4), C8(220, 4), C8(221, 4),
-    C8(222, 4), C8(223, 4), C8(224, 4), C8(225, 4), C8(226, 4), C8(227, 4),
-    C8(228, 4), C8(229, 4), C8(230, 4), C8(231, 4), C8(232, 4), C8(233, 4),
-    C8(234, 4), C8(235, 4), C8(236, 4), C8(237, 4), C8(238, 4), C8(239, 4),
-    C8(240, 4), C8(241, 4), C8(242, 4), C8(243, 4), C8(244, 4), C8(245, 4),
-    C8(246, 4), C8(247, 4), C8(248, 4), C8(249, 4), C8(250, 4), C8(251, 4),
-    C8(252, 4), C8(253, 4), C8(254, 4), C8(255, 4),
-};
-
-const FbBits fbStipple4Bits[16] = {
-    C4(0, 8), C4(1, 8), C4(2, 8), C4(3, 8), C4(4, 8), C4(5, 8),
-    C4(6, 8), C4(7, 8), C4(8, 8), C4(9, 8), C4(10, 8), C4(11, 8),
-    C4(12, 8), C4(13, 8), C4(14, 8), C4(15, 8),
-};
-
-const FbBits fbStipple2Bits[4] = {
-    C2(0, 16), C2(1, 16), C2(2, 16), C2(3, 16),
-};
-
-const FbBits fbStipple1Bits[2] = {
-    C1(0, 32), C1(1, 32),
-};
-
-const FbBits *const fbStippleTable[] = {
-    0,
-    fbStipple1Bits,
-    fbStipple2Bits,
-    0,
-    fbStipple4Bits,
-    0,
-    0,
-    0,
-    fbStipple8Bits,
-};
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index 0bd233e..c8be10f 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -141,12 +141,6 @@
 #define fbSolid wfbSolid
 #define fbSolid24 wfbSolid24
 #define fbSolidBoxClipped wfbSolidBoxClipped
-#define fbStipple1Bits wfbStipple1Bits
-#define fbStipple24Bits wfbStipple24Bits
-#define fbStipple2Bits wfbStipple2Bits
-#define fbStipple4Bits wfbStipple4Bits
-#define fbStipple8Bits wfbStipple8Bits
-#define fbStippleTable wfbStippleTable
 #define fbTile wfbTile
 #define fbTrapezoids wfbTrapezoids
 #define fbTriangles wfbTriangles
commit 7430fdb689678b98ac63f5a8dad13719bac777e0
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Dec 17 14:46:38 2013 -0500

    fb: Remove even/odd stipple slow-pathing
    
    This is clearly meant to be a fast path, but it appears to be a net
    loss at this point.
    
    If you really wanted to ricer-tune here, note that the inner loop of
    fbBltOne is a bit too complicated for gcc (at least 4.8.2), it doesn't
    specialize the loop for the handful of legal values of bitsPerDst, which
    means computing at runtime what could have been const-propped.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/Makefile.am b/fb/Makefile.am
index 752eabe..ff6dc3a 100644
--- a/fb/Makefile.am
+++ b/fb/Makefile.am
@@ -44,7 +44,6 @@ libfb_la_SOURCES = 	\
 	fbseg.c		\
 	fbsetsp.c	\
 	fbsolid.c	\
-	fbstipple.c	\
 	fbtile.c	\
 	fbtrap.c	\
 	fbutil.c	\
diff --git a/fb/fb.h b/fb/fb.h
index 6db5803..f7cbaf9 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -452,7 +452,6 @@ typedef struct {
     FbBits bgand, bgxor;        /* for stipples */
     FbBits fg, bg, pm;          /* expanded and filled */
     unsigned int dashLength;    /* total of all dash elements */
-    unsigned char evenStipple;  /* stipple is even */
     unsigned char bpp;          /* current drawable bpp */
 } FbGCPrivRec, *FbGCPrivPtr;
 
@@ -545,11 +544,6 @@ typedef struct {
  * Accelerated tiles are power of 2 width <= FB_UNIT
  */
 #define FbEvenTile(w)	    ((w) <= FB_UNIT && FbPowerOfTwo(w))
-/*
- * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp
- * with dstBpp a power of 2 as well
- */
-#define FbEvenStip(w,bpp)   ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp))
 
 /*
  * fb24_32.c
@@ -1338,58 +1332,6 @@ fbSolid24(FbBits * dst,
           int dstX, int width, int height, FbBits and, FbBits xor);
 
 /*
- * fbstipple.c
- */
-
-extern _X_EXPORT void
- fbTransparentSpan(FbBits * dst, FbBits stip, FbBits fgxor, int n);
-
-extern _X_EXPORT void
-
-fbEvenStipple(FbBits * dst,
-              FbStride dstStride,
-              int dstX,
-              int dstBpp,
-              int width,
-              int height,
-              FbStip * stip,
-              FbStride stipStride,
-              int stipHeight,
-              FbBits fgand,
-              FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
-
-extern _X_EXPORT void
-
-fbOddStipple(FbBits * dst,
-             FbStride dstStride,
-             int dstX,
-             int dstBpp,
-             int width,
-             int height,
-             FbStip * stip,
-             FbStride stipStride,
-             int stipWidth,
-             int stipHeight,
-             FbBits fgand,
-             FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
-
-extern _X_EXPORT void
-
-fbStipple(FbBits * dst,
-          FbStride dstStride,
-          int dstX,
-          int dstBpp,
-          int width,
-          int height,
-          FbStip * stip,
-          FbStride stipStride,
-          int stipWidth,
-          int stipHeight,
-          Bool even,
-          FbBits fgand,
-          FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot);
-
-/*
  * fbtile.c
  */
 
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index 3042c4b..bd3229a 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -62,26 +62,6 @@
 	bits = (src < srcEnd ? READ(src++) : 0); \
 }
 
-#define LaneCases1(n,a)	    case n: FbLaneCase(n,a); break
-#define LaneCases2(n,a)	    LaneCases1(n,a); LaneCases1(n+1,a)
-#define LaneCases4(n,a)	    LaneCases2(n,a); LaneCases2(n+2,a)
-#define LaneCases8(n,a)	    LaneCases4(n,a); LaneCases4(n+4,a)
-#define LaneCases16(n,a)    LaneCases8(n,a); LaneCases8(n+8,a)
-
-#define LaneCases(a)	    LaneCases16(0,a)
-
-static const CARD8 fb8Lane[16] = {
-    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
-};
-
-static const CARD8 fb16Lane[16] = {
-    0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-static const CARD8 fb32Lane[16] = {
-    0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
 void
 fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
          int srcX,              /* bit position of source */
@@ -110,7 +90,6 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
     Bool transparent;           /* accelerate 0 nop */
     int srcinc;                 /* source units consumed */
     Bool endNeedsLoad = FALSE;  /* need load for endmask */
-    const CARD8 *fbLane;
     int startbyte, endbyte;
 
     if (dstBpp == 24) {
@@ -176,15 +155,6 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
     fbBits = 0;                 /* unused */
     if (pixelsPerDst <= 8)
         fbBits = fbStippleTable[pixelsPerDst];
-    fbLane = 0;
-    if (transparent && fgand == 0) {
-        if (dstBpp == 8)
-            fbLane = fb8Lane;
-        if (dstBpp == 16)
-            fbLane = fb16Lane;
-        if (dstBpp == 32)
-            fbLane = fb32Lane;
-    }
 
     /*
      * Compute total number of destination words written, but 
@@ -235,15 +205,10 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
              */
             if (startmask) {
                 mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
-                if (fbLane) {
-                    fbTransparentSpan(dst, mask & startmask, fgxor, 1);
-                }
-                else {
-                    if (mask || !transparent)
-                        FbDoLeftMaskByteStippleRRop(dst, mask,
-                                                    fgand, fgxor, bgand, bgxor,
-                                                    startbyte, startmask);
-                }
+                if (mask || !transparent)
+                    FbDoLeftMaskByteStippleRRop(dst, mask,
+                                                fgand, fgxor, bgand, bgxor,
+                                                startbyte, startmask);
                 bits = FbStipLeft(bits, pixelsPerDst);
                 dst++;
                 n--;
@@ -263,29 +228,15 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
                     }
                 }
                 else {
-                    if (fbLane) {
-                        while (bits && n) {
-                            switch (fbLane[FbLeftStipBits(bits, pixelsPerDst)]) {
-                                LaneCases((CARD8 *) dst);
-                            }
-                            bits = FbStipLeft(bits, pixelsPerDst);
-                            dst++;
-                            n--;
-                        }
-                        dst += n;
-                    }
-                    else {
-                        while (n--) {
-                            left = FbLeftStipBits(bits, pixelsPerDst);
-                            if (left || !transparent) {
-                                mask = fbBits[left];
-                                WRITE(dst, FbStippleRRop(READ(dst), mask,
-                                                         fgand, fgxor, bgand,
-                                                         bgxor));
-                            }
-                            dst++;
-                            bits = FbStipLeft(bits, pixelsPerDst);
+                    while (n--) {
+                        left = FbLeftStipBits(bits, pixelsPerDst);
+                        if (left || !transparent) {
+                            mask = fbBits[left];
+                            WRITE(dst, FbStippleRRop(READ(dst), mask, fgand,
+                                                     fgxor, bgand, bgxor));
                         }
+                        dst++;
+                        bits = FbStipLeft(bits, pixelsPerDst);
                     }
                 }
                 if (!w)
@@ -307,15 +258,9 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
                 LoadBits;
             }
             mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
-            if (fbLane) {
-                fbTransparentSpan(dst, mask & endmask, fgxor, 1);
-            }
-            else {
-                if (mask || !transparent)
-                    FbDoRightMaskByteStippleRRop(dst, mask,
-                                                 fgand, fgxor, bgand, bgxor,
-                                                 endbyte, endmask);
-            }
+            if (mask || !transparent)
+                FbDoRightMaskByteStippleRRop(dst, mask, fgand, fgxor,
+                                             bgand, bgxor, endbyte, endmask);
         }
         dst += dstStride;
         src += srcStride;
diff --git a/fb/fbfill.c b/fb/fbfill.c
index de9d6b3..ad09671 100644
--- a/fb/fbfill.c
+++ b/fb/fbfill.c
@@ -26,6 +26,50 @@
 
 #include "fb.h"
 
+static void
+fbStipple(FbBits * dst, FbStride dstStride,
+          int dstX, int dstBpp,
+          int width, int height,
+          FbStip * stip, FbStride stipStride,
+          int stipWidth, int stipHeight,
+          FbBits fgand, FbBits fgxor,
+          FbBits bgand, FbBits bgxor,
+          int xRot, int yRot)
+{
+    int stipX, stipY, sx;
+    int widthTmp;
+    int h, w;
+    int x, y;
+
+    modulus(-yRot, stipHeight, stipY);
+    modulus(dstX / dstBpp - xRot, stipWidth, stipX);
+    y = 0;
+    while (height) {
+        h = stipHeight - stipY;
+        if (h > height)
+            h = height;
+        height -= h;
+        widthTmp = width;
+        x = dstX;
+        sx = stipX;
+        while (widthTmp) {
+            w = (stipWidth - sx) * dstBpp;
+            if (w > widthTmp)
+                w = widthTmp;
+            widthTmp -= w;
+            fbBltOne(stip + stipY * stipStride,
+                     stipStride,
+                     sx,
+                     dst + y * dstStride,
+                     dstStride, x, dstBpp, w, h, fgand, fgxor, bgand, bgxor);
+            x += w;
+            sx = 0;
+        }
+        y += h;
+        stipY = 0;
+    }
+}
+
 void
 fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height)
 {
@@ -97,7 +141,7 @@ fbFill(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int width, int height)
             fbStipple(dst + (y + dstYoff) * dstStride, dstStride,
                       (x + dstXoff) * dstBpp, dstBpp, width * dstBpp, height,
                       stip, stipStride, stipWidth, stipHeight,
-                      pPriv->evenStipple, fgand, fgxor, bgand, bgxor,
+                      fgand, fgxor, bgand, bgxor,
                       pGC->patOrg.x + pDrawable->x + dstXoff,
                       pGC->patOrg.y + pDrawable->y - y);
             fbFinishAccess(&pStip->drawable);
diff --git a/fb/fbgc.c b/fb/fbgc.c
index f4d7f3a..21c9b03 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -110,80 +110,6 @@ fbPadPixmap(PixmapPtr pPixmap)
     fbFinishAccess(&pPixmap->drawable);
 }
 
-/*
- * Verify that 'bits' repeats every 'len' bits
- */
-static Bool
-fbBitsRepeat(FbBits bits, int len, int width)
-{
-    FbBits mask = FbBitsMask(0, len);
-    FbBits orig = bits & mask;
-    int i;
-
-    if (width > FB_UNIT)
-        width = FB_UNIT;
-    for (i = 0; i < width / len; i++) {
-        if ((bits & mask) != orig)
-            return FALSE;
-        bits = FbScrLeft(bits, len);
-    }
-    return TRUE;
-}
-
-/*
- * Check whether an entire bitmap line is a repetition of
- * the first 'len' bits
- */
-static Bool
-fbLineRepeat(FbBits * bits, int len, int width)
-{
-    FbBits first = bits[0];
-
-    if (!fbBitsRepeat(first, len, width))
-        return FALSE;
-    width = (width + FB_UNIT - 1) >> FB_SHIFT;
-    bits++;
-    while (--width)
-        if (READ(bits) != first)
-            return FALSE;
-    return TRUE;
-}
-
-/*
- * The even stipple code wants the first FB_UNIT/bpp bits on
- * each scanline to represent the entire stipple
- */
-static Bool
-fbCanEvenStipple(PixmapPtr pStipple, int bpp)
-{
-    int len = FB_UNIT / bpp;
-    FbBits *bits;
-    int stride;
-    int stip_bpp;
-    _X_UNUSED int stipXoff, stipYoff;
-    int h;
-
-    /* can't even stipple 24bpp drawables */
-    if ((bpp & (bpp - 1)) != 0)
-        return FALSE;
-    /* make sure the stipple width is a multiple of the even stipple width */
-    if (pStipple->drawable.width % len != 0)
-        return FALSE;
-    fbGetDrawable(&pStipple->drawable, bits, stride, stip_bpp, stipXoff,
-                  stipYoff);
-    h = pStipple->drawable.height;
-    /* check to see that the stipple repeats horizontally */
-    while (h--) {
-        if (!fbLineRepeat(bits, len, pStipple->drawable.width)) {
-            fbFinishAccess(&pStipple->drawable);
-            return FALSE;
-        }
-        bits += stride;
-    }
-    fbFinishAccess(&pStipple->drawable);
-    return TRUE;
-}
-
 void
 fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
 {
@@ -239,16 +165,7 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
             fbPadPixmap(pGC->tile.pixmap);
     }
     if (changes & GCStipple) {
-        pPriv->evenStipple = FALSE;
-
         if (pGC->stipple) {
-
-            /* can we do an even stipple ?? */
-            if (FbEvenStip(pGC->stipple->drawable.width,
-                           pDrawable->bitsPerPixel) &&
-                (fbCanEvenStipple(pGC->stipple, pDrawable->bitsPerPixel)))
-                pPriv->evenStipple = TRUE;
-
             if (pGC->stipple->drawable.width * pDrawable->bitsPerPixel <
                 FB_UNIT)
                 fbPadPixmap(pGC->stipple);
diff --git a/fb/fbstipple.c b/fb/fbstipple.c
deleted file mode 100644
index 9a877c1..0000000
--- a/fb/fbstipple.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Keith Packard makes no
- * representations about the suitability of this software for any purpose.  It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "fb.h"
-
-/*
- * This is a slight abuse of the preprocessor to generate repetitive
- * code, the idea is to generate code for each case of a copy-mode
- * transparent stipple
- */
-#define LaneCases1(c,a)	    case c: \
-				while (n--) { FbLaneCase(c,a); a++; } \
-				break
-#define LaneCases2(c,a)	    LaneCases1(c,a); LaneCases1(c+1,a)
-#define LaneCases4(c,a)	    LaneCases2(c,a); LaneCases2(c+2,a)
-#define LaneCases8(c,a)	    LaneCases4(c,a); LaneCases4(c+4,a)
-#define LaneCases16(c,a)    LaneCases8(c,a); LaneCases8(c+8,a)
-
-#define LaneCases(a)	    LaneCases16(0,a)
-
-/*
- * Repeat a transparent stipple across a scanline n times
- */
-
-void
-fbTransparentSpan(FbBits * dst, FbBits stip, FbBits fgxor, int n)
-{
-    FbStip s;
-
-    s = ((FbStip) (stip) & 0x01);
-    s |= ((FbStip) (stip >> 8) & 0x02);
-    s |= ((FbStip) (stip >> 16) & 0x04);
-    s |= ((FbStip) (stip >> 24) & 0x08);
-    switch (s) {
-        LaneCases(dst);
-    }
-}
-
-void
-fbEvenStipple(FbBits * dst,
-              FbStride dstStride,
-              int dstX,
-              int dstBpp,
-              int width,
-              int height,
-              FbStip * stip,
-              FbStride stipStride,
-              int stipHeight,
-              FbBits fgand,
-              FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
-{
-    FbBits startmask, endmask;
-    FbBits mask, and, xor;
-    int nmiddle, n;
-    FbStip *s, *stipEnd, bits;
-    int rot, stipX, stipY;
-    int pixelsPerDst;
-    const FbBits *fbBits;
-    Bool transparent;
-    int startbyte, endbyte;
-
-    /*
-     * Check for a transparent stipple (stencil)
-     */
-    transparent = FALSE;
-    if (dstBpp >= 8 && fgand == 0 && bgand == FB_ALLONES && bgxor == 0)
-        transparent = TRUE;
-
-    pixelsPerDst = FB_UNIT / dstBpp;
-    /*
-     * Adjust dest pointers
-     */
-    dst += dstX >> FB_SHIFT;
-    dstX &= FB_MASK;
-    FbMaskBitsBytes(dstX, width, fgand == 0 && bgand == 0,
-                    startmask, startbyte, nmiddle, endmask, endbyte);
-
-    if (startmask)
-        dstStride--;
-    dstStride -= nmiddle;
-
-    xRot *= dstBpp;
-    /*
-     * Compute stip start scanline and rotation parameters
-     */
-    stipEnd = stip + stipStride * stipHeight;
-    modulus(-yRot, stipHeight, stipY);
-    s = stip + stipStride * stipY;
-    modulus(-xRot, FB_UNIT, stipX);
-    rot = stipX;
-
-    /*
-     * Get pointer to stipple mask array for this depth
-     */
-    /* fbStippleTable covers all valid bpp (4,8,16,32) */
-    fbBits = fbStippleTable[pixelsPerDst];
-
-    while (height--) {
-        /*
-         * Extract stipple bits for this scanline;
-         */
-        bits = READ(s);
-        s += stipStride;
-        if (s == stipEnd)
-            s = stip;
-        mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
-        /*
-         * Rotate into position and compute reduced rop values
-         */
-        mask = FbRotLeft(mask, rot);
-        and = (fgand & mask) | (bgand & ~mask);
-        xor = (fgxor & mask) | (bgxor & ~mask);
-
-        if (transparent) {
-            if (startmask) {
-                fbTransparentSpan(dst, mask & startmask, fgxor, 1);
-                dst++;
-            }
-            fbTransparentSpan(dst, mask, fgxor, nmiddle);
-            dst += nmiddle;
-            if (endmask)
-                fbTransparentSpan(dst, mask & endmask, fgxor, 1);
-        }
-        else {
-            /*
-             * Fill scanline
-             */
-            if (startmask) {
-                FbDoLeftMaskByteRRop(dst, startbyte, startmask, and, xor);
-                dst++;
-            }
-            n = nmiddle;
-            if (!and)
-                while (n--)
-                    WRITE(dst++, xor);
-            else {
-                while (n--) {
-                    WRITE(dst, FbDoRRop(READ(dst), and, xor));
-                    dst++;
-                }
-            }
-            if (endmask)
-                FbDoRightMaskByteRRop(dst, endbyte, endmask, and, xor);
-        }
-        dst += dstStride;
-    }
-}
-
-void
-fbOddStipple(FbBits * dst,
-             FbStride dstStride,
-             int dstX,
-             int dstBpp,
-             int width,
-             int height,
-             FbStip * stip,
-             FbStride stipStride,
-             int stipWidth,
-             int stipHeight,
-             FbBits fgand,
-             FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
-{
-    int stipX, stipY, sx;
-    int widthTmp;
-    int h, w;
-    int x, y;
-
-    modulus(-yRot, stipHeight, stipY);
-    modulus(dstX / dstBpp - xRot, stipWidth, stipX);
-    y = 0;
-    while (height) {
-        h = stipHeight - stipY;
-        if (h > height)
-            h = height;
-        height -= h;
-        widthTmp = width;
-        x = dstX;
-        sx = stipX;
-        while (widthTmp) {
-            w = (stipWidth - sx) * dstBpp;
-            if (w > widthTmp)
-                w = widthTmp;
-            widthTmp -= w;
-            fbBltOne(stip + stipY * stipStride,
-                     stipStride,
-                     sx,
-                     dst + y * dstStride,
-                     dstStride, x, dstBpp, w, h, fgand, fgxor, bgand, bgxor);
-            x += w;
-            sx = 0;
-        }
-        y += h;
-        stipY = 0;
-    }
-}
-
-void
-fbStipple(FbBits * dst,
-          FbStride dstStride,
-          int dstX,
-          int dstBpp,
-          int width,
-          int height,
-          FbStip * stip,
-          FbStride stipStride,
-          int stipWidth,
-          int stipHeight,
-          Bool even,
-          FbBits fgand,
-          FbBits fgxor, FbBits bgand, FbBits bgxor, int xRot, int yRot)
-{
-    if (even)
-        fbEvenStipple(dst, dstStride, dstX, dstBpp, width, height,
-                      stip, stipStride, stipHeight,
-                      fgand, fgxor, bgand, bgxor, xRot, yRot);
-    else
-        fbOddStipple(dst, dstStride, dstX, dstBpp, width, height,
-                     stip, stipStride, stipWidth, stipHeight,
-                     fgand, fgxor, bgand, bgxor, xRot, yRot);
-}
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index a80858a..0bd233e 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -58,7 +58,6 @@
 #define fbDots24 wfbDots24
 #define fbDots32 wfbDots32
 #define fbDots8 wfbDots8
-#define fbEvenStipple wfbEvenStipple
 #define fbEvenTile wfbEvenTile
 #define fbExpandDirectColors wfbExpandDirectColors
 #define fbFill wfbFill
@@ -84,7 +83,6 @@
 #define fbInitVisuals wfbInitVisuals
 #define fbListInstalledColormaps wfbListInstalledColormaps
 #define FbMergeRopBits wFbMergeRopBits
-#define fbOddStipple wfbOddStipple
 #define fbOddTile wfbOddTile
 #define fbOver wfbOver
 #define fbOver24 wfbOver24
@@ -143,7 +141,6 @@
 #define fbSolid wfbSolid
 #define fbSolid24 wfbSolid24
 #define fbSolidBoxClipped wfbSolidBoxClipped
-#define fbStipple wfbStipple
 #define fbStipple1Bits wfbStipple1Bits
 #define fbStipple24Bits wfbStipple24Bits
 #define fbStipple2Bits wfbStipple2Bits
@@ -151,7 +148,6 @@
 #define fbStipple8Bits wfbStipple8Bits
 #define fbStippleTable wfbStippleTable
 #define fbTile wfbTile
-#define fbTransparentSpan wfbTransparentSpan
 #define fbTrapezoids wfbTrapezoids
 #define fbTriangles wfbTriangles
 #define fbUninstallColormap wfbUninstallColormap
commit a1983736853814d34450c0a0de1c4f6ee308423d
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Jun 17 11:24:06 2014 -0400

    fb: FB_SHIFT is 5 (and FB_UNIT is 32)
    
    The other paths don't build or work, PCI and other buses are almost
    always 32 bit data paths, and X doesn't really support pixels bigger
    than that anyway.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fb.h b/fb/fb.h
index d176bb3..6db5803 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -83,11 +83,7 @@
 #define FB_SHIFT    LOG2_BITMAP_PAD
 #endif
 
-#if FB_SHIFT < LOG2_BITMAP_PAD
-error FB_SHIFT must be >= LOG2_BITMAP_PAD
-#endif
 #define FB_UNIT	    (1 << FB_SHIFT)
-#define FB_HALFUNIT (1 << (FB_SHIFT-1))
 #define FB_MASK	    (FB_UNIT - 1)
 #define FB_ALLONES  ((FbBits) -1)
 #if GLYPHPADBYTES != 4
@@ -105,37 +101,15 @@ error FB_SHIFT must be >= LOG2_BITMAP_PAD
 #define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT)))
 #define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT)))
 #define FbFullMask(n)   ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1))
-#if FB_SHIFT == 6
-#ifdef WIN32
-typedef unsigned __int64 FbBits;
-#else
-#if defined(__alpha__) || defined(__alpha) || \
-      defined(ia64) || defined(__ia64__) || \
-      defined(__sparc64__) || defined(_LP64) || \
-      defined(__s390x__) || \
-      defined(amd64) || defined (__amd64__) || \
-      defined (__powerpc64__)
-typedef unsigned long FbBits;
-#else
-typedef unsigned long long FbBits;
-#endif
-#endif
-#endif
 
 #if FB_SHIFT == 5
 typedef CARD32 FbBits;
-#endif
-
-#if FB_SHIFT == 4
-typedef CARD16 FbBits;
+#else
+#error "Unsupported FB_SHIFT"
 #endif
 
 #if LOG2_BITMAP_PAD == FB_SHIFT
 typedef FbBits FbStip;
-#else
-#if LOG2_BITMAP_PAD == 5
-typedef CARD32 FbStip;
-#endif
 #endif
 
 typedef int FbStride;
@@ -264,122 +238,8 @@ extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
     n >>= FB_SHIFT; \
 }
 
-#if FB_SHIFT == 6
-#define FbDoLeftMaskByteRRop6Cases(dst,xor) \
-    case (sizeof (FbBits) - 7) | (1 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 7) | (2 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 7) | (3 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	break; \
-    case (sizeof (FbBits) - 7) | (4 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 7) | (5 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
-	break; \
-    case (sizeof (FbBits) - 7) | (6 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 7): \
-	FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
-	break; \
-    case (sizeof (FbBits) - 6) | (1 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 6) | (2 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	break; \
-    case (sizeof (FbBits) - 6) | (3 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 6) | (4 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
-	break; \
-    case (sizeof (FbBits) - 6) | (5 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 6): \
-	FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
-	break; \
-    case (sizeof (FbBits) - 5) | (1 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 5) | (2 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 5) | (3 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
-	break; \
-    case (sizeof (FbBits) - 5) | (4 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 5): \
-	FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
-	break; \
-    case (sizeof (FbBits) - 4) | (1 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 4) | (2 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
-	break; \
-    case (sizeof (FbBits) - 4) | (3 << (FB_SHIFT - 3)): \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \
-	FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
-	break; \
-    case (sizeof (FbBits) - 4): \
-	FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \
-	break;
-
-#define FbDoRightMaskByteRRop6Cases(dst,xor) \
-    case 4: \
-	FbStorePart(dst,0,CARD32,xor); \
-	break; \
-    case 5: \
-	FbStorePart(dst,0,CARD32,xor); \
-	FbStorePart(dst,4,CARD8,xor); \
-	break; \
-    case 6: \
-	FbStorePart(dst,0,CARD32,xor); \
-	FbStorePart(dst,4,CARD16,xor); \
-	break; \
-    case 7: \
-	FbStorePart(dst,0,CARD32,xor); \
-	FbStorePart(dst,4,CARD16,xor); \
-	FbStorePart(dst,6,CARD8,xor); \
-	break;
-#else
-#define FbDoLeftMaskByteRRop6Cases(dst,xor)
-#define FbDoRightMaskByteRRop6Cases(dst,xor)
-#endif
-
 #define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \
     switch (lb) { \
-    FbDoLeftMaskByteRRop6Cases(dst,xor) \
     case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \
 	FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
 	break; \
@@ -416,7 +276,6 @@ extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
 	FbStorePart(dst,0,CARD16,xor); \
 	FbStorePart(dst,2,CARD8,xor); \
 	break; \
-    FbDoRightMaskByteRRop6Cases(dst,xor) \
     default: \
 	WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, r)); \
     } \
@@ -470,21 +329,7 @@ extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
 	FbLaneCase2((n)>>2,a,(o)+2)					\
     }
 
-#define FbLaneCase8(n,a,o)						\
-    if ((n) == 0x0ff) {							\
-	*(FbBits *) ((a)+(o)) = fgxor;					\
-    } else {								\
-	FbLaneCase4((n)&15,a,o)						\
-	FbLaneCase4((n)>>4,a,(o)+4)					\
-    }
-
-#if FB_SHIFT == 6
-#define FbLaneCase(n,a)   FbLaneCase8(n,(CARD8 *) (a),0)
-#endif
-
-#if FB_SHIFT == 5
 #define FbLaneCase(n,a)   FbLaneCase4(n,(CARD8 *) (a),0)
-#endif
 
 /* Rotate a filled pixel value to the specified alignement */
 #define FbRot24(p,b)	    (FbScrRight(p,b) | FbScrLeft(p,24-(b)))
@@ -497,19 +342,6 @@ extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
 #define FbPrev24Stip(p)	(FbRot24(p,FB_STIP_UNIT%24))
 
 /* step a rotation value to the next/previous rotation value */
-#if FB_UNIT == 64
-#define FbNext24Rot(r)        ((r) == 16 ? 0 : (r) + 8)
-#define FbPrev24Rot(r)        ((r) == 0 ? 16 : (r) - 8)
-
-#if IMAGE_BYTE_ORDER == MSBFirst
-#define FbFirst24Rot(x)		(((x) + 8) % 24)
-#else
-#define FbFirst24Rot(x)		((x) % 24)
-#endif
-
-#endif
-
-#if FB_UNIT == 32
 #define FbNext24Rot(r)        ((r) == 0 ? 16 : (r) - 8)
 #define FbPrev24Rot(r)        ((r) == 16 ? 0 : (r) + 8)
 
@@ -518,7 +350,6 @@ extern _X_EXPORT void fbSetBits(FbStip * bits, int stride, FbStip data);
 #else
 #define FbFirst24Rot(x)		((x) % 24)
 #endif
-#endif
 
 #define FbNext24RotStip(r)        ((r) == 0 ? 16 : (r) - 8)
 #define FbPrev24RotStip(r)        ((r) == 16 ? 0 : (r) + 8)
diff --git a/fb/fbbits.c b/fb/fbbits.c
index ac44f3e..d7d089c 100644
--- a/fb/fbbits.c
+++ b/fb/fbbits.c
@@ -70,9 +70,6 @@
 #define POLYSEGMENT fbPolySegment16
 #define BITS	    CARD16
 #define BITS2	    CARD32
-#if FB_SHIFT == 6
-#define BITS4	    FbBits
-#endif
 
 #include "fbbits.h"
 
@@ -85,9 +82,6 @@
 #undef POLYSEGMENT
 #undef BITS
 #undef BITS2
-#if FB_SHIFT == 6
-#undef BITS4
-#endif
 
 #define BRESSOLID   fbBresSolid24
 #define BRESDASH    fbBresDash24
@@ -155,9 +149,6 @@
 #define POLYLINE    fbPolyline32
 #define POLYSEGMENT fbPolySegment32
 #define BITS	    CARD32
-#if FB_SHIFT == 6
-#define BITS2	    FbBits
-#endif
 
 #include "fbbits.h"
 
@@ -169,6 +160,3 @@
 #undef POLYLINE
 #undef POLYSEGMENT
 #undef BITS
-#if FB_SHIFT == 6
-#undef BITS2
-#endif
diff --git a/fb/fbblt.c b/fb/fbblt.c
index c615106..b412365 100644
--- a/fb/fbblt.c
+++ b/fb/fbblt.c
@@ -520,277 +520,12 @@ fbBlt24(FbBits * srcLine,
 #endif
 }
 
-#if FB_SHIFT == FB_STIP_SHIFT + 1
-
-/*
- * Could be generalized to FB_SHIFT > FB_STIP_SHIFT + 1 by
- * creating an ring of values stepped through for each line
- */
-
-void
-fbBltOdd(FbBits * srcLine,
-         FbStride srcStrideEven,
-         FbStride srcStrideOdd,
-         int srcXEven,
-         int srcXOdd,
-         FbBits * dstLine,
-         FbStride dstStrideEven,
-         FbStride dstStrideOdd,
-         int dstXEven,
-         int dstXOdd, int width, int height, int alu, FbBits pm, int bpp)
-{
-    FbBits *src;
-    int leftShiftEven, rightShiftEven;
-    FbBits startmaskEven, endmaskEven;
-    int nmiddleEven;
-
-    FbBits *dst;
-    int leftShiftOdd, rightShiftOdd;
-    FbBits startmaskOdd, endmaskOdd;
-    int nmiddleOdd;
-
-    int leftShift, rightShift;
-    FbBits startmask, endmask;
-    int nmiddle;
-
-    int srcX, dstX;
-
-    FbBits bits, bits1;
-    int n;
-
-    Bool destInvarient;
-    Bool even;
-
-    FbDeclareMergeRop();
-
-    FbInitializeMergeRop(alu, pm);
-    destInvarient = FbDestInvarientMergeRop();
-
-    srcLine += srcXEven >> FB_SHIFT;
-    dstLine += dstXEven >> FB_SHIFT;
-    srcXEven &= FB_MASK;
-    dstXEven &= FB_MASK;
-    srcXOdd &= FB_MASK;
-    dstXOdd &= FB_MASK;
-
-    FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven);
-    FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd);
-
-    even = TRUE;
-    InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven);
-    InitializeShifts(srcXOdd, dstXOdd, leftShiftOdd, rightShiftOdd);
-    while (height--) {
-        src = srcLine;
-        dst = dstLine;
-        if (even) {
-            srcX = srcXEven;
-            dstX = dstXEven;
-            startmask = startmaskEven;
-            endmask = endmaskEven;
-            nmiddle = nmiddleEven;
-            leftShift = leftShiftEven;
-            rightShift = rightShiftEven;
-            srcLine += srcStrideEven;
-            dstLine += dstStrideEven;
-            even = FALSE;
-        }
-        else {
-            srcX = srcXOdd;
-            dstX = dstXOdd;
-            startmask = startmaskOdd;
-            endmask = endmaskOdd;
-            nmiddle = nmiddleOdd;
-            leftShift = leftShiftOdd;
-            rightShift = rightShiftOdd;
-            srcLine += srcStrideOdd;
-            dstLine += dstStrideOdd;
-            even = TRUE;
-        }
-        if (srcX == dstX) {
-            if (startmask) {
-                bits = READ(src++);
-                WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), startmask));
-                dst++;
-            }
-            n = nmiddle;
-            if (destInvarient) {
-                while (n--) {
-                    bits = READ(src++);
-                    WRITE(dst, FbDoDestInvarientMergeRop(bits));
-                    dst++;
-                }
-            }
-            else {
-                while (n--) {
-                    bits = READ(src++);
-                    WRITE(dst, FbDoMergeRop(bits, READ(dst)));
-                    dst++;
-                }
-            }
-            if (endmask) {
-                bits = READ(src);
-                WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask));
-            }
-        }
-        else {
-            bits = 0;
-            if (srcX > dstX)
-                bits = READ(src++);
-            if (startmask) {
-                bits1 = FbScrLeft(bits, leftShift);
-                bits = READ(src++);
-                bits1 |= FbScrRight(bits, rightShift);
-                WRITE(dst, FbDoMaskMergeRop(bits1, READ(dst), startmask));
-                dst++;
-            }
-            n = nmiddle;
-            if (destInvarient) {
-                while (n--) {
-                    bits1 = FbScrLeft(bits, leftShift);
-                    bits = READ(src++);
-                    bits1 |= FbScrRight(bits, rightShift);
-                    WRITE(dst, FbDoDestInvarientMergeRop(bits1));
-                    dst++;
-                }
-            }
-            else {
-                while (n--) {
-                    bits1 = FbScrLeft(bits, leftShift);
-                    bits = READ(src++);
-                    bits1 |= FbScrRight(bits, rightShift);
-                    WRITE(dst, FbDoMergeRop(bits1, READ(dst)));
-                    dst++;
-                }
-            }
-            if (endmask) {
-                bits1 = FbScrLeft(bits, leftShift);
-                if (FbScrLeft(endmask, rightShift)) {
-                    bits = READ(src);
-                    bits1 |= FbScrRight(bits, rightShift);
-                }
-                WRITE(dst, FbDoMaskMergeRop(bits1, READ(dst), endmask));
-            }
-        }
-    }
-}
-
-void
-fbBltOdd24(FbBits * srcLine,
-           FbStride srcStrideEven,
-           FbStride srcStrideOdd,
-           int srcXEven,
-           int srcXOdd,
-           FbBits * dstLine,
-           FbStride dstStrideEven,
-           FbStride dstStrideOdd,
-           int dstXEven, int dstXOdd, int width, int height, int alu, FbBits pm)
-{
-    Bool even = TRUE;
-
-    while (height--) {
-        if (even) {
-            fbBlt24Line(srcLine, srcXEven, dstLine, dstXEven,
-                        width, alu, pm, FALSE);
-            srcLine += srcStrideEven;
-            dstLine += dstStrideEven;
-            even = FALSE;
-        }
-        else {
-            fbBlt24Line(srcLine, srcXOdd, dstLine, dstXOdd,
-                        width, alu, pm, FALSE);
-            srcLine += srcStrideOdd;
-            dstLine += dstStrideOdd;
-            even = TRUE;
-        }
-    }
-}
-
-#endif
-
-#if FB_STIP_SHIFT != FB_SHIFT
-void
-fbSetBltOdd(FbStip * stip,
-            FbStride stipStride,
-            int srcX,
-            FbBits ** bits,
-            FbStride * strideEven,
-            FbStride * strideOdd, int *srcXEven, int *srcXOdd)
-{
-    int srcAdjust;
-    int strideAdjust;
-
-    /*
-     * bytes needed to align source
-     */
-    srcAdjust = (((int) stip) & (FB_MASK >> 3));
-    /*
-     * FbStip units needed to align stride
-     */
-    strideAdjust = stipStride & (FB_MASK >> FB_STIP_SHIFT);
-
-    *bits = (FbBits *) ((char *) stip - srcAdjust);
-    if (srcAdjust) {
-        *strideEven = FbStipStrideToBitsStride(stipStride + 1);
-        *strideOdd = FbStipStrideToBitsStride(stipStride);
-
-        *srcXEven = srcX + (srcAdjust << 3);
-        *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT);
-    }
-    else {
-        *strideEven = FbStipStrideToBitsStride(stipStride);
-        *strideOdd = FbStipStrideToBitsStride(stipStride + 1);
-
-        *srcXEven = srcX;
-        *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT);
-    }
-}
-#endif
-
 void
 fbBltStip(FbStip * src, FbStride srcStride,     /* in FbStip units, not FbBits units */
           int srcX, FbStip * dst, FbStride dstStride,   /* in FbStip units, not FbBits units */
           int dstX, int width, int height, int alu, FbBits pm, int bpp)
 {
-#if FB_STIP_SHIFT != FB_SHIFT
-    if (FB_STIP_ODDSTRIDE(srcStride) || FB_STIP_ODDPTR(src) ||
-        FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) {
-        FbStride srcStrideEven, srcStrideOdd;
-        FbStride dstStrideEven, dstStrideOdd;
-        int srcXEven, srcXOdd;
-        int dstXEven, dstXOdd;
-        FbBits *s, *d;
-        int sx, dx;
-
-        src += srcX >> FB_STIP_SHIFT;
-        srcX &= FB_STIP_MASK;
-        dst += dstX >> FB_STIP_SHIFT;
-        dstX &= FB_STIP_MASK;
-
-        fbSetBltOdd(src, srcStride, srcX,
-                    &s, &srcStrideEven, &srcStrideOdd, &srcXEven, &srcXOdd);
-
-        fbSetBltOdd(dst, dstStride, dstX,
-                    &d, &dstStrideEven, &dstStrideOdd, &dstXEven, &dstXOdd);
-
-        if (bpp == 24 && !FbCheck24Pix(pm)) {
-            fbBltOdd24(s, srcStrideEven, srcStrideOdd,
-                       srcXEven, srcXOdd,
-                       d, dstStrideEven, dstStrideOdd,
-                       dstXEven, dstXOdd, width, height, alu, pm);
-        }
-        else {
-            fbBltOdd(s, srcStrideEven, srcStrideOdd,
-                     srcXEven, srcXOdd,
-                     d, dstStrideEven, dstStrideOdd,
-                     dstXEven, dstXOdd, width, height, alu, pm, bpp);
-        }
-    }
-    else
-#endif
-    {
-        fbBlt((FbBits *) src, FbStipStrideToBitsStride(srcStride),
-              srcX,
-              (FbBits *) dst, FbStipStrideToBitsStride(dstStride),
-              dstX, width, height, alu, pm, bpp, FALSE, FALSE);
-    }
+    fbBlt((FbBits *) src, FbStipStrideToBitsStride(srcStride), srcX,
+          (FbBits *) dst, FbStipStrideToBitsStride(dstStride), dstX,
+          width, height, alu, pm, bpp, FALSE, FALSE);
 }
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index d2f0416..3042c4b 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -67,59 +67,9 @@
 #define LaneCases4(n,a)	    LaneCases2(n,a); LaneCases2(n+2,a)
 #define LaneCases8(n,a)	    LaneCases4(n,a); LaneCases4(n+4,a)
 #define LaneCases16(n,a)    LaneCases8(n,a); LaneCases8(n+8,a)
-#define LaneCases32(n,a)    LaneCases16(n,a); LaneCases16(n+16,a)
-#define LaneCases64(n,a)    LaneCases32(n,a); LaneCases32(n+32,a)
-#define LaneCases128(n,a)   LaneCases64(n,a); LaneCases64(n+64,a)
-#define LaneCases256(n,a)   LaneCases128(n,a); LaneCases128(n+128,a)
 
-#if FB_SHIFT == 6
-#define LaneCases(a)	    LaneCases256(0,a)
-#endif
-
-#if FB_SHIFT == 5
 #define LaneCases(a)	    LaneCases16(0,a)
-#endif
-
-#if FB_SHIFT == 6
-static const CARD8 fb8Lane[256] = {
-    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
-        21,
-    22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
-    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
-    60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
-    79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
-    98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
-        113, 114, 115,
-    116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
-        131, 132, 133,
-    134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
-        149, 150, 151,
-    152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
-        167, 168, 169,
-    170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
-        185, 186, 187,
-    188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202,
-        203, 204, 205,
-    206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
-        221, 222, 223,
-    224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238,
-        239, 240, 241,
-    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
-};
-
-static const CARD8 fb16Lane[256] = {
-    0x00, 0x03, 0x0c, 0x0f,
-    0x30, 0x33, 0x3c, 0x3f,
-    0xc0, 0xc3, 0xcc, 0xcf,
-    0xf0, 0xf3, 0xfc, 0xff,
-};
-
-static const CARD8 fb32Lane[16] = {
-    0x00, 0x0f, 0xf0, 0xff,
-};
-#endif
 
-#if FB_SHIFT == 5
 static const CARD8 fb8Lane[16] = {
     0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
 };
@@ -131,7 +81,6 @@ static const CARD8 fb16Lane[16] = {
 static const CARD8 fb32Lane[16] = {
     0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 };
-#endif
 
 void
 fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
@@ -285,12 +234,7 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
              * Consume stipple bits for startmask
              */
             if (startmask) {
-#if FB_UNIT > 32
-                if (pixelsPerDst == 16)
-                    mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
-                else
-#endif
-                    mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+                mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
                 if (fbLane) {
                     fbTransparentSpan(dst, mask & startmask, fgxor, 1);
                 }
@@ -312,12 +256,7 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
                 w -= n;
                 if (copy) {
                     while (n--) {
-#if FB_UNIT > 32
-                        if (pixelsPerDst == 16)
-                            mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
-                        else
-#endif
-                            mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+                        mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
                         WRITE(dst, FbOpaqueStipple(mask, fgxor, bgxor));
                         dst++;
                         bits = FbStipLeft(bits, pixelsPerDst);
@@ -367,12 +306,7 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
             if (endNeedsLoad) {
                 LoadBits;
             }
-#if FB_UNIT > 32
-            if (pixelsPerDst == 16)
-                mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
-            else
-#endif
-                mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+            mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
             if (fbLane) {
                 fbTransparentSpan(dst, mask & endmask, fgxor, 1);
             }
@@ -410,47 +344,6 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
 
 #define SelMask24(b,n,r)	((((b) >> n) & 1) * Mask24(n,r))
 
-/*
- * Untested for MSBFirst or FB_UNIT == 32
- */
-
-#if FB_UNIT == 64
-#define C4_24(b,r) \
-    (SelMask24(b,0,r) | \
-     SelMask24(b,1,r) | \
-     SelMask24(b,2,r) | \
-     SelMask24(b,3,r))
-
-#define FbStip24New(rot)    (2 + (rot != 0))
-#define FbStip24Len	    4
-
-const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
-    /* rotate 0 */
-    {
-     C4_24(0, 0), C4_24(1, 0), C4_24(2, 0), C4_24(3, 0),
-     C4_24(4, 0), C4_24(5, 0), C4_24(6, 0), C4_24(7, 0),
-     C4_24(8, 0), C4_24(9, 0), C4_24(10, 0), C4_24(11, 0),
-     C4_24(12, 0), C4_24(13, 0), C4_24(14, 0), C4_24(15, 0),
-     },
-    /* rotate 8 */
-    {
-     C4_24(0, 8), C4_24(1, 8), C4_24(2, 8), C4_24(3, 8),
-     C4_24(4, 8), C4_24(5, 8), C4_24(6, 8), C4_24(7, 8),
-     C4_24(8, 8), C4_24(9, 8), C4_24(10, 8), C4_24(11, 8),
-     C4_24(12, 8), C4_24(13, 8), C4_24(14, 8), C4_24(15, 8),
-     },
-    /* rotate 16 */
-    {
-     C4_24(0, 16), C4_24(1, 16), C4_24(2, 16), C4_24(3, 16),
-     C4_24(4, 16), C4_24(5, 16), C4_24(6, 16), C4_24(7, 16),
-     C4_24(8, 16), C4_24(9, 16), C4_24(10, 16), C4_24(11, 16),
-     C4_24(12, 16), C4_24(13, 16), C4_24(14, 16), C4_24(15, 16),
-     }
-};
-
-#endif
-
-#if FB_UNIT == 32
 #define C2_24(b,r)  \
     (SelMask24(b,0,r) | \
      SelMask24(b,1,r))
@@ -476,7 +369,6 @@ const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
      C2_24(0, 16), C2_24(1, 16), C2_24(2, 16), C2_24(3, 16),
      }
 };
-#endif
 
 #if BITMAP_BIT_ORDER == LSBFirst
 
diff --git a/fb/fbglyph.c b/fb/fbglyph.c
index 4f2904c..8484782 100644
--- a/fb/fbglyph.c
+++ b/fb/fbglyph.c
@@ -56,11 +56,7 @@ fbGlyphIn(RegionPtr pRegion, int x, int y, int width, int height)
 #define WRITE1(d,n,fg)	WRITE((d) + (n), (CARD8) fg)
 #define WRITE2(d,n,fg)	WRITE((CARD16 *) &(d[n]), (CARD16) fg)
 #define WRITE4(d,n,fg)	WRITE((CARD32 *) &(d[n]), (CARD32) fg)
-#if FB_UNIT == 6 && IMAGE_BYTE_ORDER == LSBFirst
-#define WRITE8(d)	WRITE((FbBits *) &(d[0]), fg)
-#else
 #define WRITE8(d)	WRITE4(d,0,_ABCA), WRITE4(d,4,_BCAB)
-#endif
 
 /*
  * This is a bit tricky, but it's brief.  Write 12 bytes worth
diff --git a/fb/fbpict.c b/fb/fbpict.c
index f9c9917..7a9e46a 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -309,17 +309,9 @@ create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
         return NULL;
 
 #ifdef FB_ACCESS_WRAPPER
-#if FB_SHIFT==5
-
     pixman_image_set_accessors(image,
                                (pixman_read_memory_func_t) wfbReadMemory,
                                (pixman_write_memory_func_t) wfbWriteMemory);
-
-#else
-
-#error The pixman library only works when FbBits is 32 bits wide
-
-#endif
 #endif
 
     /* pCompositeClip is undefined for source pictures, so
diff --git a/fb/fbrop.h b/fb/fbrop.h
index 4362adb..b995f23 100644
--- a/fb/fbrop.h
+++ b/fb/fbrop.h
@@ -95,10 +95,6 @@ extern _X_EXPORT const FbMergeRopRec FbMergeRopBits[16];
  * Stippling operations; 
  */
 
-extern _X_EXPORT const FbBits fbStipple16Bits[256];     /* half of table */
-
-#define FbStipple16Bits(b) \
-    (fbStipple16Bits[(b)&0xff] | fbStipple16Bits[(b) >> 8] << FB_HALFUNIT)
 extern _X_EXPORT const FbBits fbStipple8Bits[256];
 extern _X_EXPORT const FbBits fbStipple4Bits[16];
 extern _X_EXPORT const FbBits fbStipple2Bits[4];
diff --git a/fb/fbstipple.c b/fb/fbstipple.c
index f6c84a2..9a877c1 100644
--- a/fb/fbstipple.c
+++ b/fb/fbstipple.c
@@ -38,18 +38,8 @@
 #define LaneCases4(c,a)	    LaneCases2(c,a); LaneCases2(c+2,a)
 #define LaneCases8(c,a)	    LaneCases4(c,a); LaneCases4(c+4,a)
 #define LaneCases16(c,a)    LaneCases8(c,a); LaneCases8(c+8,a)
-#define LaneCases32(c,a)    LaneCases16(c,a); LaneCases16(c+16,a)
-#define LaneCases64(c,a)    LaneCases32(c,a); LaneCases32(c+32,a)
-#define LaneCases128(c,a)   LaneCases64(c,a); LaneCases64(c+64,a)
-#define LaneCases256(c,a)   LaneCases128(c,a); LaneCases128(c+128,a)
 
-#if FB_SHIFT == 6
-#define LaneCases(a)	    LaneCases256(0,a)
-#endif
-
-#if FB_SHIFT == 5
 #define LaneCases(a)	    LaneCases16(0,a)
-#endif
 
 /*
  * Repeat a transparent stipple across a scanline n times
@@ -64,12 +54,6 @@ fbTransparentSpan(FbBits * dst, FbBits stip, FbBits fgxor, int n)
     s |= ((FbStip) (stip >> 8) & 0x02);
     s |= ((FbStip) (stip >> 16) & 0x04);
     s |= ((FbStip) (stip >> 24) & 0x08);
-#if FB_SHIFT > 5
-    s |= ((FbStip) (stip >> 32) & 0x10);
-    s |= ((FbStip) (stip >> 40) & 0x20);
-    s |= ((FbStip) (stip >> 48) & 0x40);
-    s |= ((FbStip) (stip >> 56) & 0x80);
-#endif
     switch (s) {
         LaneCases(dst);
     }
@@ -142,12 +126,7 @@ fbEvenStipple(FbBits * dst,
         s += stipStride;
         if (s == stipEnd)
             s = stip;
-#if FB_UNIT > 32
-        if (pixelsPerDst == 16)
-            mask = FbStipple16Bits(FbLeftStipBits(bits, 16));
-        else
-#endif
-            mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
+        mask = fbBits[FbLeftStipBits(bits, pixelsPerDst)];
         /*
          * Rotate into position and compute reduced rop values
          */
diff --git a/fb/fbutil.c b/fb/fbutil.c
index 2ca80d1..9d66c2a 100644
--- a/fb/fbutil.c
+++ b/fb/fbutil.c
@@ -174,24 +174,6 @@ const FbMergeRopRec FbMergeRopBits[16] = {
      SelMask(b,6,w) | \
      SelMask(b,7,w))
 
-#if FB_UNIT == 16
-#define fbStipple16Bits 0
-#define fbStipple8Bits 0
-const FbBits fbStipple4Bits[16] = {
-    C4(0, 4), C4(1, 4), C4(2, 4), C4(3, 4), C4(4, 4), C4(5, 4),
-    C4(6, 4), C4(7, 4), C4(8, 4), C4(9, 4), C4(10, 4), C4(11, 4),
-    C4(12, 4), C4(13, 4), C4(14, 4), C4(15, 4),
-};
-
-const FbBits fbStipple2Bits[4] = {
-    C2(0, 8), C2(1, 8), C2(2, 8), C2(3, 8),
-};
-
-const FbBits fbStipple1Bits[2] = {
-    C1(0, 16), C1(1, 16),
-};
-#endif
-#if FB_UNIT == 32
 #define fbStipple16Bits 0
 const FbBits fbStipple8Bits[256] = {
     C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4),
@@ -252,112 +234,7 @@ const FbBits fbStipple2Bits[4] = {
 const FbBits fbStipple1Bits[2] = {
     C1(0, 32), C1(1, 32),
 };
-#endif
-#if FB_UNIT == 64
-const FbBits fbStipple16Bits[256] = {
-    C8(0, 4), C8(1, 4), C8(2, 4), C8(3, 4), C8(4, 4), C8(5, 4),
-    C8(6, 4), C8(7, 4), C8(8, 4), C8(9, 4), C8(10, 4), C8(11, 4),
-    C8(12, 4), C8(13, 4), C8(14, 4), C8(15, 4), C8(16, 4), C8(17, 4),
-    C8(18, 4), C8(19, 4), C8(20, 4), C8(21, 4), C8(22, 4), C8(23, 4),
-    C8(24, 4), C8(25, 4), C8(26, 4), C8(27, 4), C8(28, 4), C8(29, 4),
-    C8(30, 4), C8(31, 4), C8(32, 4), C8(33, 4), C8(34, 4), C8(35, 4),
-    C8(36, 4), C8(37, 4), C8(38, 4), C8(39, 4), C8(40, 4), C8(41, 4),
-    C8(42, 4), C8(43, 4), C8(44, 4), C8(45, 4), C8(46, 4), C8(47, 4),
-    C8(48, 4), C8(49, 4), C8(50, 4), C8(51, 4), C8(52, 4), C8(53, 4),
-    C8(54, 4), C8(55, 4), C8(56, 4), C8(57, 4), C8(58, 4), C8(59, 4),
-    C8(60, 4), C8(61, 4), C8(62, 4), C8(63, 4), C8(64, 4), C8(65, 4),
-    C8(66, 4), C8(67, 4), C8(68, 4), C8(69, 4), C8(70, 4), C8(71, 4),
-    C8(72, 4), C8(73, 4), C8(74, 4), C8(75, 4), C8(76, 4), C8(77, 4),
-    C8(78, 4), C8(79, 4), C8(80, 4), C8(81, 4), C8(82, 4), C8(83, 4),
-    C8(84, 4), C8(85, 4), C8(86, 4), C8(87, 4), C8(88, 4), C8(89, 4),
-    C8(90, 4), C8(91, 4), C8(92, 4), C8(93, 4), C8(94, 4), C8(95, 4),
-    C8(96, 4), C8(97, 4), C8(98, 4), C8(99, 4), C8(100, 4), C8(101, 4),
-    C8(102, 4), C8(103, 4), C8(104, 4), C8(105, 4), C8(106, 4), C8(107, 4),
-    C8(108, 4), C8(109, 4), C8(110, 4), C8(111, 4), C8(112, 4), C8(113, 4),
-    C8(114, 4), C8(115, 4), C8(116, 4), C8(117, 4), C8(118, 4), C8(119, 4),
-    C8(120, 4), C8(121, 4), C8(122, 4), C8(123, 4), C8(124, 4), C8(125, 4),
-    C8(126, 4), C8(127, 4), C8(128, 4), C8(129, 4), C8(130, 4), C8(131, 4),
-    C8(132, 4), C8(133, 4), C8(134, 4), C8(135, 4), C8(136, 4), C8(137, 4),
-    C8(138, 4), C8(139, 4), C8(140, 4), C8(141, 4), C8(142, 4), C8(143, 4),
-    C8(144, 4), C8(145, 4), C8(146, 4), C8(147, 4), C8(148, 4), C8(149, 4),
-    C8(150, 4), C8(151, 4), C8(152, 4), C8(153, 4), C8(154, 4), C8(155, 4),
-    C8(156, 4), C8(157, 4), C8(158, 4), C8(159, 4), C8(160, 4), C8(161, 4),
-    C8(162, 4), C8(163, 4), C8(164, 4), C8(165, 4), C8(166, 4), C8(167, 4),
-    C8(168, 4), C8(169, 4), C8(170, 4), C8(171, 4), C8(172, 4), C8(173, 4),
-    C8(174, 4), C8(175, 4), C8(176, 4), C8(177, 4), C8(178, 4), C8(179, 4),
-    C8(180, 4), C8(181, 4), C8(182, 4), C8(183, 4), C8(184, 4), C8(185, 4),
-    C8(186, 4), C8(187, 4), C8(188, 4), C8(189, 4), C8(190, 4), C8(191, 4),
-    C8(192, 4), C8(193, 4), C8(194, 4), C8(195, 4), C8(196, 4), C8(197, 4),
-    C8(198, 4), C8(199, 4), C8(200, 4), C8(201, 4), C8(202, 4), C8(203, 4),
-    C8(204, 4), C8(205, 4), C8(206, 4), C8(207, 4), C8(208, 4), C8(209, 4),
-    C8(210, 4), C8(211, 4), C8(212, 4), C8(213, 4), C8(214, 4), C8(215, 4),
-    C8(216, 4), C8(217, 4), C8(218, 4), C8(219, 4), C8(220, 4), C8(221, 4),
-    C8(222, 4), C8(223, 4), C8(224, 4), C8(225, 4), C8(226, 4), C8(227, 4),
-    C8(228, 4), C8(229, 4), C8(230, 4), C8(231, 4), C8(232, 4), C8(233, 4),
-    C8(234, 4), C8(235, 4), C8(236, 4), C8(237, 4), C8(238, 4), C8(239, 4),
-    C8(240, 4), C8(241, 4), C8(242, 4), C8(243, 4), C8(244, 4), C8(245, 4),
-    C8(246, 4), C8(247, 4), C8(248, 4), C8(249, 4), C8(250, 4), C8(251, 4),
-    C8(252, 4), C8(253, 4), C8(254, 4), C8(255, 4),
-};
-
-const FbBits fbStipple8Bits[256] = {
-    C8(0, 8), C8(1, 8), C8(2, 8), C8(3, 8), C8(4, 8), C8(5, 8),
-    C8(6, 8), C8(7, 8), C8(8, 8), C8(9, 8), C8(10, 8), C8(11, 8),
-    C8(12, 8), C8(13, 8), C8(14, 8), C8(15, 8), C8(16, 8), C8(17, 8),
-    C8(18, 8), C8(19, 8), C8(20, 8), C8(21, 8), C8(22, 8), C8(23, 8),
-    C8(24, 8), C8(25, 8), C8(26, 8), C8(27, 8), C8(28, 8), C8(29, 8),
-    C8(30, 8), C8(31, 8), C8(32, 8), C8(33, 8), C8(34, 8), C8(35, 8),
-    C8(36, 8), C8(37, 8), C8(38, 8), C8(39, 8), C8(40, 8), C8(41, 8),
-    C8(42, 8), C8(43, 8), C8(44, 8), C8(45, 8), C8(46, 8), C8(47, 8),
-    C8(48, 8), C8(49, 8), C8(50, 8), C8(51, 8), C8(52, 8), C8(53, 8),
-    C8(54, 8), C8(55, 8), C8(56, 8), C8(57, 8), C8(58, 8), C8(59, 8),
-    C8(60, 8), C8(61, 8), C8(62, 8), C8(63, 8), C8(64, 8), C8(65, 8),
-    C8(66, 8), C8(67, 8), C8(68, 8), C8(69, 8), C8(70, 8), C8(71, 8),
-    C8(72, 8), C8(73, 8), C8(74, 8), C8(75, 8), C8(76, 8), C8(77, 8),
-    C8(78, 8), C8(79, 8), C8(80, 8), C8(81, 8), C8(82, 8), C8(83, 8),
-    C8(84, 8), C8(85, 8), C8(86, 8), C8(87, 8), C8(88, 8), C8(89, 8),
-    C8(90, 8), C8(91, 8), C8(92, 8), C8(93, 8), C8(94, 8), C8(95, 8),
-    C8(96, 8), C8(97, 8), C8(98, 8), C8(99, 8), C8(100, 8), C8(101, 8),
-    C8(102, 8), C8(103, 8), C8(104, 8), C8(105, 8), C8(106, 8), C8(107, 8),
-    C8(108, 8), C8(109, 8), C8(110, 8), C8(111, 8), C8(112, 8), C8(113, 8),
-    C8(114, 8), C8(115, 8), C8(116, 8), C8(117, 8), C8(118, 8), C8(119, 8),
-    C8(120, 8), C8(121, 8), C8(122, 8), C8(123, 8), C8(124, 8), C8(125, 8),
-    C8(126, 8), C8(127, 8), C8(128, 8), C8(129, 8), C8(130, 8), C8(131, 8),
-    C8(132, 8), C8(133, 8), C8(134, 8), C8(135, 8), C8(136, 8), C8(137, 8),
-    C8(138, 8), C8(139, 8), C8(140, 8), C8(141, 8), C8(142, 8), C8(143, 8),
-    C8(144, 8), C8(145, 8), C8(146, 8), C8(147, 8), C8(148, 8), C8(149, 8),
-    C8(150, 8), C8(151, 8), C8(152, 8), C8(153, 8), C8(154, 8), C8(155, 8),
-    C8(156, 8), C8(157, 8), C8(158, 8), C8(159, 8), C8(160, 8), C8(161, 8),
-    C8(162, 8), C8(163, 8), C8(164, 8), C8(165, 8), C8(166, 8), C8(167, 8),
-    C8(168, 8), C8(169, 8), C8(170, 8), C8(171, 8), C8(172, 8), C8(173, 8),
-    C8(174, 8), C8(175, 8), C8(176, 8), C8(177, 8), C8(178, 8), C8(179, 8),
-    C8(180, 8), C8(181, 8), C8(182, 8), C8(183, 8), C8(184, 8), C8(185, 8),
-    C8(186, 8), C8(187, 8), C8(188, 8), C8(189, 8), C8(190, 8), C8(191, 8),
-    C8(192, 8), C8(193, 8), C8(194, 8), C8(195, 8), C8(196, 8), C8(197, 8),
-    C8(198, 8), C8(199, 8), C8(200, 8), C8(201, 8), C8(202, 8), C8(203, 8),
-    C8(204, 8), C8(205, 8), C8(206, 8), C8(207, 8), C8(208, 8), C8(209, 8),
-    C8(210, 8), C8(211, 8), C8(212, 8), C8(213, 8), C8(214, 8), C8(215, 8),
-    C8(216, 8), C8(217, 8), C8(218, 8), C8(219, 8), C8(220, 8), C8(221, 8),
-    C8(222, 8), C8(223, 8), C8(224, 8), C8(225, 8), C8(226, 8), C8(227, 8),
-    C8(228, 8), C8(229, 8), C8(230, 8), C8(231, 8), C8(232, 8), C8(233, 8),
-    C8(234, 8), C8(235, 8), C8(236, 8), C8(237, 8), C8(238, 8), C8(239, 8),
-    C8(240, 8), C8(241, 8), C8(242, 8), C8(243, 8), C8(244, 8), C8(245, 8),
-    C8(246, 8), C8(247, 8), C8(248, 8), C8(249, 8), C8(250, 8), C8(251, 8),
-    C8(252, 8), C8(253, 8), C8(254, 8), C8(255, 8),
-};
-
-const FbBits fbStipple4Bits[16] = {
-    C4(0, 16), C4(1, 16), C4(2, 16), C4(3, 16), C4(4, 16), C4(5, 16),
-    C4(6, 16), C4(7, 16), C4(8, 16), C4(9, 16), C4(10, 16), C4(11, 16),
-    C4(12, 16), C4(13, 16), C4(14, 16), C4(15, 16),
-};
 
-const FbBits fbStipple2Bits[4] = {
-    C2(0, 32), C2(1, 32), C2(2, 32), C2(3, 32),
-};
-
-#define fbStipple1Bits 0
-#endif
 const FbBits *const fbStippleTable[] = {
     0,
     fbStipple1Bits,
commit 3d35bd6b79957a3441abd87a377f0beb058997ed
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Mar 24 12:01:54 2014 -0400

    fb: Eliminate fbLaneTable, staticize fb{8,16,32}Lane
    
    gcc doesn't appear to be smart enough to fold away the indirection here,
    even if you make fbLaneTable const.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index bfcb5a2..d2f0416 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -81,7 +81,7 @@
 #endif
 
 #if FB_SHIFT == 6
-CARD8 fb8Lane[256] = {
+static const CARD8 fb8Lane[256] = {
     0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
         21,
     22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
@@ -107,40 +107,32 @@ CARD8 fb8Lane[256] = {
     242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255,
 };
 
-CARD8 fb16Lane[256] = {
+static const CARD8 fb16Lane[256] = {
     0x00, 0x03, 0x0c, 0x0f,
     0x30, 0x33, 0x3c, 0x3f,
     0xc0, 0xc3, 0xcc, 0xcf,
     0xf0, 0xf3, 0xfc, 0xff,
 };
 
-CARD8 fb32Lane[16] = {
+static const CARD8 fb32Lane[16] = {
     0x00, 0x0f, 0xf0, 0xff,
 };
 #endif
 
 #if FB_SHIFT == 5
-CARD8 fb8Lane[16] = {
+static const CARD8 fb8Lane[16] = {
     0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
 };
 
-CARD8 fb16Lane[16] = {
+static const CARD8 fb16Lane[16] = {
     0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 };
 
-CARD8 fb32Lane[16] = {
+static const CARD8 fb32Lane[16] = {
     0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 };
 #endif
 
-CARD8 *fbLaneTable[33] = {
-    0, 0, 0, 0, 0, 0, 0, 0,
-    fb8Lane, 0, 0, 0, 0, 0, 0, 0,
-    fb16Lane, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0,
-    fb32Lane
-};
-
 void
 fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
          int srcX,              /* bit position of source */
@@ -169,7 +161,7 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
     Bool transparent;           /* accelerate 0 nop */
     int srcinc;                 /* source units consumed */
     Bool endNeedsLoad = FALSE;  /* need load for endmask */
-    CARD8 *fbLane;
+    const CARD8 *fbLane;
     int startbyte, endbyte;
 
     if (dstBpp == 24) {
@@ -236,8 +228,14 @@ fbBltOne(FbStip * src, FbStride srcStride,      /* FbStip units per scanline */
     if (pixelsPerDst <= 8)
         fbBits = fbStippleTable[pixelsPerDst];
     fbLane = 0;
-    if (transparent && fgand == 0 && dstBpp >= 8)
-        fbLane = fbLaneTable[dstBpp];
+    if (transparent && fgand == 0) {
+        if (dstBpp == 8)
+            fbLane = fb8Lane;
+        if (dstBpp == 16)
+            fbLane = fb16Lane;
+        if (dstBpp == 32)
+            fbLane = fb32Lane;
+    }
 
     /*
      * Compute total number of destination words written, but 
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
index 749c6d0..a80858a 100644
--- a/fb/wfbrename.h
+++ b/fb/wfbrename.h
@@ -1,4 +1,3 @@
-#define fb16Lane wfb16Lane
 #define fb24_32CopyMtoN wfb24_32CopyMtoN
 #define fb24_32CreateScreenResources wfb24_32CreateScreenResources
 #define fb24_32GetImage wfb24_32GetImage
@@ -7,8 +6,6 @@
 #define fb24_32PutZImage wfb24_32PutZImage
 #define fb24_32ReformatTile wfb24_32ReformatTile
 #define fb24_32SetSpans wfb24_32SetSpans
-#define fb32Lane wfb32Lane
-#define fb8Lane wfb8Lane
 #define fbAddTraps wfbAddTraps
 #define fbAddTriangles wfbAddTriangles
 #define fbAllocatePrivates wfbAllocatePrivates
@@ -85,8 +82,6 @@
 #define fbIn wfbIn
 #define fbInitializeColormap wfbInitializeColormap
 #define fbInitVisuals wfbInitVisuals
-#define fbInstallColormap wfbInstallColormap
-#define fbLaneTable wfbLaneTable
 #define fbListInstalledColormaps wfbListInstalledColormaps
 #define FbMergeRopBits wFbMergeRopBits
 #define fbOddStipple wfbOddStipple
commit 86ce6262975a7d53d9331723beb49cbe7bd02b48
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep 26 12:39:38 2014 -0400

    mi: Fold micursor.c into mipointer.c
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/Makefile.am b/mi/Makefile.am
index ce416c4..110c3f5 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -16,7 +16,6 @@ libmi_la_SOURCES = 	\
 	micmap.h	\
 	micoord.h	\
 	micopy.c	\
-	micursor.c	\
 	midash.c	\
 	midispcur.c	\
 	mieq.c		\
diff --git a/mi/micursor.c b/mi/micursor.c
deleted file mode 100644
index 13ce776..0000000
--- a/mi/micursor.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "scrnintstr.h"
-#include "cursor.h"
-#include "misc.h"
-#include "mi.h"
-#include "inputstr.h"
-
-void
-miRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScr,
-                CursorPtr pCurs, Bool displayed)
-{
-    /*
-     * This is guaranteed to correct any color-dependent state which may have
-     * been bound up in private state created by RealizeCursor
-     */
-    pScr->UnrealizeCursor(pDev, pScr, pCurs);
-    pScr->RealizeCursor(pDev, pScr, pCurs);
-    if (displayed)
-        pScr->DisplayCursor(pDev, pScr, pCurs);
-}
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 6fa416d..9805425 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -273,6 +273,20 @@ miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
     return TRUE;
 }
 
+void
+miRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScr,
+                CursorPtr pCurs, Bool displayed)
+{
+    /*
+     * This is guaranteed to correct any color-dependent state which may have
+     * been bound up in private state created by RealizeCursor
+     */
+    pScr->UnrealizeCursor(pDev, pScr, pCurs);
+    pScr->RealizeCursor(pDev, pScr, pCurs);
+    if (displayed)
+        pScr->DisplayCursor(pDev, pScr, pCurs);
+}
+
 /**
  * Set up sprite information for the device.
  * This function will be called once for each device after it is initialized
commit 3b63900e90f44cf85a4d3391d23407b3bb6db52b
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep 26 12:34:15 2014 -0400

    mi: Fold mipolyutil.c into mipoly.c
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/Makefile.am b/mi/Makefile.am
index 44e4f20..ce416c4 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -40,7 +40,6 @@ libmi_la_SOURCES = 	\
 	mipolyrect.c	\
 	mipolyseg.c	\
 	mipolytext.c	\
-	mipolyutil.c	\
 	mipushpxl.c	\
 	miscanfill.h	\
 	miscrinit.c	\
diff --git a/mi/mipoly.c b/mi/mipoly.c
index 3d49789..0ed2edb 100644
--- a/mi/mipoly.c
+++ b/mi/mipoly.c
@@ -61,6 +61,291 @@ SOFTWARE.
 #include "mipoly.h"
 #include "regionstr.h"
 
+/*
+ * Insert the given edge into the edge table.  First we must find the correct
+ * bucket in the Edge table, then find the right slot in the bucket.  Finally,
+ * we can insert it.
+ */
+static Bool
+miInsertEdgeInET(EdgeTable * ET, EdgeTableEntry * ETE, int scanline,
+                 ScanLineListBlock ** SLLBlock, int *iSLLBlock)
+{
+    EdgeTableEntry *start, *prev;
+    ScanLineList *pSLL, *pPrevSLL;
+    ScanLineListBlock *tmpSLLBlock;
+
+    /*
+     * find the right bucket to put the edge into
+     */
+    pPrevSLL = &ET->scanlines;
+    pSLL = pPrevSLL->next;
+    while (pSLL && (pSLL->scanline < scanline)) {
+        pPrevSLL = pSLL;
+        pSLL = pSLL->next;
+    }
+
+    /*
+     * reassign pSLL (pointer to ScanLineList) if necessary
+     */
+    if ((!pSLL) || (pSLL->scanline > scanline)) {
+        if (*iSLLBlock > SLLSPERBLOCK - 1) {
+            tmpSLLBlock = malloc(sizeof(ScanLineListBlock));
+            if (!tmpSLLBlock)
+                return FALSE;
+            (*SLLBlock)->next = tmpSLLBlock;
+            tmpSLLBlock->next = NULL;
+            *SLLBlock = tmpSLLBlock;
+            *iSLLBlock = 0;
+        }
+        pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
+
+        pSLL->next = pPrevSLL->next;
+        pSLL->edgelist = NULL;
+        pPrevSLL->next = pSLL;
+    }
+    pSLL->scanline = scanline;
+
+    /*
+     * now insert the edge in the right bucket
+     */
+    prev = NULL;
+    start = pSLL->edgelist;
+    while (start && (start->bres.minor < ETE->bres.minor)) {
+        prev = start;
+        start = start->next;
+    }
+    ETE->next = start;
+
+    if (prev)
+        prev->next = ETE;
+    else
+        pSLL->edgelist = ETE;
+    return TRUE;
+}
+
+static void
+miFreeStorage(ScanLineListBlock * pSLLBlock)
+{
+    ScanLineListBlock *tmpSLLBlock;
+
+    while (pSLLBlock) {
+        tmpSLLBlock = pSLLBlock->next;
+        free(pSLLBlock);
+        pSLLBlock = tmpSLLBlock;
+    }
+}
+
+/*
+ * CreateEdgeTable
+ *
+ * This routine creates the edge table for scan converting polygons.
+ * The Edge Table (ET) looks like:
+ *
+ * EdgeTable
+ *  --------
+ * |  ymax  |        ScanLineLists
+ * |scanline|-->------------>-------------->...
+ *  --------   |scanline|   |scanline|
+ *             |edgelist|   |edgelist|
+ *             ---------    ---------
+ *                 |             |
+ *                 |             |
+ *                 V             V
+ *           list of ETEs   list of ETEs
+ *
+ * where ETE is an EdgeTableEntry data structure, and there is one ScanLineList
+ * per scanline at which an edge is initially entered.
+ */
+
+static Bool
+miCreateETandAET(int count, DDXPointPtr pts, EdgeTable * ET,
+                 EdgeTableEntry * AET, EdgeTableEntry * pETEs,
+                 ScanLineListBlock * pSLLBlock)
+{
+    DDXPointPtr top, bottom;
+    DDXPointPtr PrevPt, CurrPt;
+    int iSLLBlock = 0;
+
+    int dy;
+
+    if (count < 2)
+        return TRUE;
+
+    /*
+     *  initialize the Active Edge Table
+     */
+    AET->next = NULL;
+    AET->back = NULL;
+    AET->nextWETE = NULL;
+    AET->bres.minor = MININT;
+
+    /*
+     *  initialize the Edge Table.
+     */
+    ET->scanlines.next = NULL;
+    ET->ymax = MININT;
+    ET->ymin = MAXINT;
+    pSLLBlock->next = NULL;
+
+    PrevPt = &pts[count - 1];
+
+    /*
+     *  for each vertex in the array of points.
+     *  In this loop we are dealing with two vertices at
+     *  a time -- these make up one edge of the polygon.
+     */
+    while (count--) {
+        CurrPt = pts++;
+
+        /*
+         *  find out which point is above and which is below.
+         */
+        if (PrevPt->y > CurrPt->y) {
+            bottom = PrevPt, top = CurrPt;
+            pETEs->ClockWise = 0;
+        }
+        else {
+            bottom = CurrPt, top = PrevPt;
+            pETEs->ClockWise = 1;
+        }
+
+        /*
+         * don't add horizontal edges to the Edge table.
+         */
+        if (bottom->y != top->y) {
+            pETEs->ymax = bottom->y - 1; /* -1 so we don't get last scanline */
+
+            /*
+             *  initialize integer edge algorithm
+             */
+            dy = bottom->y - top->y;
+            BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres);
+
+            if (!miInsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock)) {
+                miFreeStorage(pSLLBlock->next);
+                return FALSE;
+            }
+
+            ET->ymax = max(ET->ymax, PrevPt->y);
+            ET->ymin = min(ET->ymin, PrevPt->y);
+            pETEs++;
+        }
+
+        PrevPt = CurrPt;
+    }
+    return TRUE;
+}
+
+/*
+ * This routine moves EdgeTableEntries from the EdgeTable into the Active Edge
+ * Table, leaving them sorted by smaller x coordinate.
+ */
+
+static void
+miloadAET(EdgeTableEntry * AET, EdgeTableEntry * ETEs)
+{
+    EdgeTableEntry *pPrevAET;
+    EdgeTableEntry *tmp;
+
+    pPrevAET = AET;
+    AET = AET->next;
+    while (ETEs) {
+        while (AET && (AET->bres.minor < ETEs->bres.minor)) {
+            pPrevAET = AET;
+            AET = AET->next;
+        }
+        tmp = ETEs->next;
+        ETEs->next = AET;
+        if (AET)
+            AET->back = ETEs;
+        ETEs->back = pPrevAET;
+        pPrevAET->next = ETEs;
+        pPrevAET = ETEs;
+
+        ETEs = tmp;
+    }
+}
+
+/*
+ * computeWAET
+ *
+ * This routine links the AET by the nextWETE (winding EdgeTableEntry) link for
+ * use by the winding number rule.  The final Active Edge Table (AET) might
+ * look something like:
+ *
+ * AET
+ * ----------  ---------   ---------
+ * |ymax    |  |ymax    |  |ymax    |
+ * | ...    |  |...     |  |...     |
+ * |next    |->|next    |->|next    |->...
+ * |nextWETE|  |nextWETE|  |nextWETE|
+ * ---------   ---------   ^--------
+ *     |                   |       |
+ *     V------------------->       V---> ...
+ *
+ */
+static void
+micomputeWAET(EdgeTableEntry * AET)
+{
+    EdgeTableEntry *pWETE;
+    int inside = 1;
+    int isInside = 0;
+
+    AET->nextWETE = NULL;
+    pWETE = AET;
+    AET = AET->next;
+    while (AET) {
+        if (AET->ClockWise)
+            isInside++;
+        else
+            isInside--;
+
+        if ((!inside && !isInside) || (inside && isInside)) {
+            pWETE->nextWETE = AET;
+            pWETE = AET;
+            inside = !inside;
+        }
+        AET = AET->next;
+    }
+    pWETE->nextWETE = NULL;
+}
+
+/*
+ * Just a simple insertion sort using pointers and back pointers to sort the
+ * Active Edge Table.
+ */
+
+static int
+miInsertionSort(EdgeTableEntry * AET)
+{
+    EdgeTableEntry *pETEchase;
+    EdgeTableEntry *pETEinsert;
+    EdgeTableEntry *pETEchaseBackTMP;
+    int changed = 0;
+
+    AET = AET->next;
+    while (AET) {
+        pETEinsert = AET;
+        pETEchase = AET;
+        while (pETEchase->back->bres.minor > AET->bres.minor)
+            pETEchase = pETEchase->back;
+
+        AET = AET->next;
+        if (pETEchase != pETEinsert) {
+            pETEchaseBackTMP = pETEchase->back;
+            pETEinsert->back->next = AET;
+            if (AET)
+                AET->back = pETEinsert->back;
+            pETEinsert->next = pETEchase;
+            pETEchase->back->next = pETEinsert;
+            pETEchase->back = pETEinsert;
+            pETEinsert->back = pETEchaseBackTMP;
+            changed = 1;
+        }
+    }
+    return changed;
+}
+
 /* Find the index of the point with the smallest y */
 static int
 getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
diff --git a/mi/mipoly.h b/mi/mipoly.h
index 02fcfc8..fc5a5cf 100644
--- a/mi/mipoly.h
+++ b/mi/mipoly.h
@@ -171,20 +171,3 @@ typedef struct _ScanLineListBlock {
       pAET = pAET->next; \
    } \
 }
-
-/* mipolyutil.c */
-
-extern Bool miCreateETandAET(int /*count */ ,
-                             DDXPointPtr /*pts */ ,
-                             EdgeTable * /*ET*/,
-                             EdgeTableEntry * /*AET*/,
-                             EdgeTableEntry * /*pETEs */ ,
-                             ScanLineListBlock *      /*pSLLBlock */);
-
-extern void miloadAET(EdgeTableEntry * /*AET*/, EdgeTableEntry * /*ETEs */);
-
-extern void micomputeWAET(EdgeTableEntry * /*AET*/);
-
-extern int miInsertionSort(EdgeTableEntry * /*AET*/);
-
-extern void miFreeStorage(ScanLineListBlock * /*pSLLBlock */);
diff --git a/mi/mipolyutil.c b/mi/mipolyutil.c
deleted file mode 100644
index 5e6301d..0000000
--- a/mi/mipolyutil.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "regionstr.h"
-#include "gc.h"
-#include "miscanfill.h"
-#include "mipoly.h"
-#include "misc.h"               /* MAXINT */
-
-/*
- *     fillUtils.c
- *
- *     Written by Brian Kelleher;  Oct. 1985
- *
- *     This module contains all of the utility functions
- *     needed to scan convert a polygon.
- *
- */
-
-/*
- *     InsertEdgeInET
- *
- *     Insert the given edge into the edge table.
- *     First we must find the correct bucket in the
- *     Edge table, then find the right slot in the
- *     bucket.  Finally, we can insert it.
- *
- */
-static Bool
-miInsertEdgeInET(EdgeTable * ET, EdgeTableEntry * ETE, int scanline,
-                 ScanLineListBlock ** SLLBlock, int *iSLLBlock)
-{
-    EdgeTableEntry *start, *prev;
-    ScanLineList *pSLL, *pPrevSLL;
-    ScanLineListBlock *tmpSLLBlock;
-
-    /*
-     * find the right bucket to put the edge into
-     */
-    pPrevSLL = &ET->scanlines;
-    pSLL = pPrevSLL->next;
-    while (pSLL && (pSLL->scanline < scanline)) {
-        pPrevSLL = pSLL;
-        pSLL = pSLL->next;
-    }
-
-    /*
-     * reassign pSLL (pointer to ScanLineList) if necessary
-     */
-    if ((!pSLL) || (pSLL->scanline > scanline)) {
-        if (*iSLLBlock > SLLSPERBLOCK - 1) {
-            tmpSLLBlock = malloc(sizeof(ScanLineListBlock));
-            if (!tmpSLLBlock)
-                return FALSE;
-            (*SLLBlock)->next = tmpSLLBlock;
-            tmpSLLBlock->next = NULL;
-            *SLLBlock = tmpSLLBlock;
-            *iSLLBlock = 0;
-        }
-        pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]);
-
-        pSLL->next = pPrevSLL->next;
-        pSLL->edgelist = NULL;
-        pPrevSLL->next = pSLL;
-    }
-    pSLL->scanline = scanline;
-
-    /*
-     * now insert the edge in the right bucket
-     */
-    prev = NULL;
-    start = pSLL->edgelist;
-    while (start && (start->bres.minor < ETE->bres.minor)) {
-        prev = start;
-        start = start->next;
-    }
-    ETE->next = start;
-
-    if (prev)
-        prev->next = ETE;
-    else
-        pSLL->edgelist = ETE;
-    return TRUE;
-}
-
-/*
- *     CreateEdgeTable
- *
- *     This routine creates the edge table for
- *     scan converting polygons. 
- *     The Edge Table (ET) looks like:
- *
- *    EdgeTable
- *     --------
- *    |  ymax  |        ScanLineLists
- *    |scanline|-->------------>-------------->...
- *     --------   |scanline|   |scanline|
- *                |edgelist|   |edgelist|
- *                ---------    ---------
- *                    |             |
- *                    |             |
- *                    V             V
- *              list of ETEs   list of ETEs
- *
- *     where ETE is an EdgeTableEntry data structure,
- *     and there is one ScanLineList per scanline at
- *     which an edge is initially entered.
- *
- */
-
-Bool
-miCreateETandAET(int count, DDXPointPtr pts, EdgeTable * ET,
-                 EdgeTableEntry * AET, EdgeTableEntry * pETEs,
-                 ScanLineListBlock * pSLLBlock)
-{
-    DDXPointPtr top, bottom;
-    DDXPointPtr PrevPt, CurrPt;
-    int iSLLBlock = 0;
-
-    int dy;
-
-    if (count < 2)
-        return TRUE;
-
-    /*
-     *  initialize the Active Edge Table
-     */
-    AET->next = NULL;
-    AET->back = NULL;
-    AET->nextWETE = NULL;
-    AET->bres.minor = MININT;
-
-    /*
-     *  initialize the Edge Table.
-     */
-    ET->scanlines.next = NULL;
-    ET->ymax = MININT;
-    ET->ymin = MAXINT;
-    pSLLBlock->next = NULL;
-
-    PrevPt = &pts[count - 1];
-
-    /*
-     *  for each vertex in the array of points.
-     *  In this loop we are dealing with two vertices at
-     *  a time -- these make up one edge of the polygon.
-     */
-    while (count--) {
-        CurrPt = pts++;
-
-        /*
-         *  find out which point is above and which is below.
-         */
-        if (PrevPt->y > CurrPt->y) {
-            bottom = PrevPt, top = CurrPt;
-            pETEs->ClockWise = 0;
-        }
-        else {
-            bottom = CurrPt, top = PrevPt;
-            pETEs->ClockWise = 1;
-        }
-
-        /*
-         * don't add horizontal edges to the Edge table.
-         */
-        if (bottom->y != top->y) {
-            pETEs->ymax = bottom->y - 1;        /* -1 so we don't get last scanline */
-
-            /*
-             *  initialize integer edge algorithm
-             */
-            dy = bottom->y - top->y;
-            BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres);
-
-            if (!miInsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock)) {
-                miFreeStorage(pSLLBlock->next);
-                return FALSE;
-            }
-
-            ET->ymax = max(ET->ymax, PrevPt->y);
-            ET->ymin = min(ET->ymin, PrevPt->y);
-            pETEs++;
-        }
-
-        PrevPt = CurrPt;
-    }
-    return TRUE;
-}
-
-/*
- *     loadAET
- *
- *     This routine moves EdgeTableEntries from the
- *     EdgeTable into the Active Edge Table,
- *     leaving them sorted by smaller x coordinate.
- *
- */
-
-void
-miloadAET(EdgeTableEntry * AET, EdgeTableEntry * ETEs)
-{
-    EdgeTableEntry *pPrevAET;
-    EdgeTableEntry *tmp;
-
-    pPrevAET = AET;
-    AET = AET->next;
-    while (ETEs) {
-        while (AET && (AET->bres.minor < ETEs->bres.minor)) {
-            pPrevAET = AET;
-            AET = AET->next;
-        }
-        tmp = ETEs->next;
-        ETEs->next = AET;
-        if (AET)
-            AET->back = ETEs;
-        ETEs->back = pPrevAET;
-        pPrevAET->next = ETEs;
-        pPrevAET = ETEs;
-
-        ETEs = tmp;
-    }
-}
-
-/*
- *     computeWAET
- *
- *     This routine links the AET by the
- *     nextWETE (winding EdgeTableEntry) link for
- *     use by the winding number rule.  The final 
- *     Active Edge Table (AET) might look something
- *     like:
- *
- *     AET
- *     ----------  ---------   ---------
- *     |ymax    |  |ymax    |  |ymax    | 
- *     | ...    |  |...     |  |...     |
- *     |next    |->|next    |->|next    |->...
- *     |nextWETE|  |nextWETE|  |nextWETE|
- *     ---------   ---------   ^--------
- *         |                   |       |
- *         V------------------->       V---> ...
- *
- */
-void
-micomputeWAET(EdgeTableEntry * AET)
-{
-    EdgeTableEntry *pWETE;
-    int inside = 1;
-    int isInside = 0;
-
-    AET->nextWETE = NULL;
-    pWETE = AET;
-    AET = AET->next;
-    while (AET) {
-        if (AET->ClockWise)
-            isInside++;
-        else
-            isInside--;
-
-        if ((!inside && !isInside) || (inside && isInside)) {
-            pWETE->nextWETE = AET;
-            pWETE = AET;
-            inside = !inside;
-        }
-        AET = AET->next;
-    }
-    pWETE->nextWETE = NULL;
-}
-
-/*
- *     InsertionSort
- *
- *     Just a simple insertion sort using
- *     pointers and back pointers to sort the Active
- *     Edge Table.
- *
- */
-
-int
-miInsertionSort(EdgeTableEntry * AET)
-{
-    EdgeTableEntry *pETEchase;
-    EdgeTableEntry *pETEinsert;
-    EdgeTableEntry *pETEchaseBackTMP;
-    int changed = 0;
-
-    AET = AET->next;
-    while (AET) {
-        pETEinsert = AET;
-        pETEchase = AET;
-        while (pETEchase->back->bres.minor > AET->bres.minor)
-            pETEchase = pETEchase->back;
-
-        AET = AET->next;
-        if (pETEchase != pETEinsert) {
-            pETEchaseBackTMP = pETEchase->back;
-            pETEinsert->back->next = AET;
-            if (AET)
-                AET->back = pETEinsert->back;
-            pETEinsert->next = pETEchase;
-            pETEchase->back->next = pETEinsert;
-            pETEchase->back = pETEinsert;
-            pETEinsert->back = pETEchaseBackTMP;
-            changed = 1;
-        }
-    }
-    return changed;
-}
-
-/*
- *     Clean up our act.
- */
-void
-miFreeStorage(ScanLineListBlock * pSLLBlock)
-{
-    ScanLineListBlock *tmpSLLBlock;
-
-    while (pSLLBlock) {
-        tmpSLLBlock = pSLLBlock->next;
-        free(pSLLBlock);
-        pSLLBlock = tmpSLLBlock;
-    }
-}
commit 21b041ef48c49ff6fc06f6e4482ffe54cb763493
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep 26 12:27:22 2014 -0400

    mi: Fold mipoly{con,gen}.c into mipoly.c
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/Makefile.am b/mi/Makefile.am
index d9139a3..44e4f20 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -36,8 +36,6 @@ libmi_la_SOURCES = 	\
 	mipointrst.h	\
 	mipoly.c	\
 	mipoly.h	\
-	mipolycon.c	\
-	mipolygen.c	\
 	mipolypnt.c	\
 	mipolyrect.c	\
 	mipolyseg.c	\
diff --git a/mi/mi.h b/mi/mi.h
index 5a455c9..3269d9b 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -288,22 +288,6 @@ extern _X_EXPORT void miFillPolygon(DrawablePtr /*dst */ ,
                                     DDXPointPtr /*pPts */
     );
 
-/* mipolycon.c */
-
-extern _X_EXPORT Bool miFillConvexPoly(DrawablePtr /*dst */ ,
-                                       GCPtr /*pgc */ ,
-                                       int /*count */ ,
-                                       DDXPointPtr      /*ptsIn */
-    );
-
-/* mipolygen.c */
-
-extern _X_EXPORT Bool miFillGeneralPoly(DrawablePtr /*dst */ ,
-                                        GCPtr /*pgc */ ,
-                                        int /*count */ ,
-                                        DDXPointPtr     /*ptsIn */
-    );
-
 /* mipolypnt.c */
 
 extern _X_EXPORT void miPolyPoint(DrawablePtr /*pDrawable */ ,
diff --git a/mi/mipoly.c b/mi/mipoly.c
index 07d9818..3d49789 100644
--- a/mi/mipoly.c
+++ b/mi/mipoly.c
@@ -47,11 +47,6 @@ SOFTWARE.
  *  mipoly.c
  *
  *  Written by Brian Kelleher; June 1986
- *
- *  Draw polygons.  This routine translates the point by the
- *  origin if pGC->miTranslate is non-zero, and calls
- *  to the appropriate routine to actually scan convert the
- *  polygon.
  */
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
@@ -62,8 +57,337 @@ SOFTWARE.
 #include "gcstruct.h"
 #include "pixmapstr.h"
 #include "mi.h"
+#include "miscanfill.h"
+#include "mipoly.h"
 #include "regionstr.h"
 
+/* Find the index of the point with the smallest y */
+static int
+getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
+{
+    DDXPointPtr ptMin;
+    int ymin, ymax;
+    DDXPointPtr ptsStart = pts;
+
+    ptMin = pts;
+    ymin = ymax = (pts++)->y;
+
+    while (--n > 0) {
+        if (pts->y < ymin) {
+            ptMin = pts;
+            ymin = pts->y;
+        }
+        if (pts->y > ymax)
+            ymax = pts->y;
+
+        pts++;
+    }
+
+    *by = ymin;
+    *ty = ymax;
+    return ptMin - ptsStart;
+}
+
+/*
+ * Written by Brian Kelleher; Dec. 1985.
+ *
+ * Fill a convex polygon.  If the given polygon is not convex, then the result
+ * is undefined.  The algorithm is to order the edges from smallest y to
+ * largest by partitioning the array into a left edge list and a right edge
+ * list.  The algorithm used to traverse each edge is an extension of
+ * Bresenham's line algorithm with y as the major axis.  For a derivation of
+ * the algorithm, see the author of this code.
+ */
+static Bool
+miFillConvexPoly(DrawablePtr dst, GCPtr pgc, int count, DDXPointPtr ptsIn)
+{
+    int xl = 0, xr = 0;         /* x vals of left and right edges */
+    int dl = 0, dr = 0;         /* decision variables             */
+    int ml = 0, m1l = 0;        /* left edge slope and slope+1    */
+    int mr = 0, m1r = 0;        /* right edge slope and slope+1   */
+    int incr1l = 0, incr2l = 0; /* left edge error increments     */
+    int incr1r = 0, incr2r = 0; /* right edge error increments    */
+    int dy;                     /* delta y                        */
+    int y;                      /* current scanline               */
+    int left, right;            /* indices to first endpoints     */
+    int i;                      /* loop counter                   */
+    int nextleft, nextright;    /* indices to second endpoints    */
+    DDXPointPtr ptsOut, FirstPoint;     /* output buffer               */
+    int *width, *FirstWidth;    /* output buffer                  */
+    int imin;                   /* index of smallest vertex (in y) */
+    int ymin;                   /* y-extents of polygon            */
+    int ymax;
+
+    /*
+     *  find leftx, bottomy, rightx, topy, and the index
+     *  of bottomy. Also translate the points.
+     */
+    imin = getPolyYBounds(ptsIn, count, &ymin, &ymax);
+
+    dy = ymax - ymin + 1;
+    if ((count < 3) || (dy < 0))
+        return TRUE;
+    ptsOut = FirstPoint = malloc(sizeof(DDXPointRec) * dy);
+    width = FirstWidth = malloc(sizeof(int) * dy);
+    if (!FirstPoint || !FirstWidth) {
+        free(FirstWidth);
+        free(FirstPoint);
+        return FALSE;
+    }
+
+    nextleft = nextright = imin;
+    y = ptsIn[nextleft].y;
+
+    /*
+     *  loop through all edges of the polygon
+     */
+    do {
+        /*
+         *  add a left edge if we need to
+         */
+        if (ptsIn[nextleft].y == y) {
+            left = nextleft;
+
+            /*
+             *  find the next edge, considering the end
+             *  conditions of the array.
+             */
+            nextleft++;
+            if (nextleft >= count)
+                nextleft = 0;
+
+            /*
+             *  now compute all of the random information
+             *  needed to run the iterative algorithm.
+             */
+            BRESINITPGON(ptsIn[nextleft].y - ptsIn[left].y,
+                         ptsIn[left].x, ptsIn[nextleft].x,
+                         xl, dl, ml, m1l, incr1l, incr2l);
+        }
+
+        /*
+         *  add a right edge if we need to
+         */
+        if (ptsIn[nextright].y == y) {
+            right = nextright;
+
+            /*
+             *  find the next edge, considering the end
+             *  conditions of the array.
+             */
+            nextright--;
+            if (nextright < 0)
+                nextright = count - 1;
+
+            /*
+             *  now compute all of the random information
+             *  needed to run the iterative algorithm.
+             */
+            BRESINITPGON(ptsIn[nextright].y - ptsIn[right].y,
+                         ptsIn[right].x, ptsIn[nextright].x,
+                         xr, dr, mr, m1r, incr1r, incr2r);
+        }
+
+        /*
+         *  generate scans to fill while we still have
+         *  a right edge as well as a left edge.
+         */
+        i = min(ptsIn[nextleft].y, ptsIn[nextright].y) - y;
+        /* in case we're called with non-convex polygon */
+        if (i < 0) {
+            free(FirstWidth);
+            free(FirstPoint);
+            return TRUE;
+        }
+        while (i-- > 0) {
+            ptsOut->y = y;
+
+            /*
+             *  reverse the edges if necessary
+             */
+            if (xl < xr) {
+                *(width++) = xr - xl;
+                (ptsOut++)->x = xl;
+            }
+            else {
+                *(width++) = xl - xr;
+                (ptsOut++)->x = xr;
+            }
+            y++;
+
+            /* increment down the edges */
+            BRESINCRPGON(dl, xl, ml, m1l, incr1l, incr2l);
+            BRESINCRPGON(dr, xr, mr, m1r, incr1r, incr2r);
+        }
+    } while (y != ymax);
+
+    /*
+     * Finally, fill the <remaining> spans
+     */
+    (*pgc->ops->FillSpans) (dst, pgc,
+                            ptsOut - FirstPoint, FirstPoint, FirstWidth, 1);
+    free(FirstWidth);
+    free(FirstPoint);
+    return TRUE;
+}
+
+/*
+ * Written by Brian Kelleher;  Oct. 1985
+ *
+ * Routine to fill a polygon.  Two fill rules are supported: frWINDING and
+ * frEVENODD.
+ */
+static Bool
+miFillGeneralPoly(DrawablePtr dst, GCPtr pgc, int count, DDXPointPtr ptsIn)
+{
+    EdgeTableEntry *pAET;       /* the Active Edge Table   */
+    int y;                      /* the current scanline    */
+    int nPts = 0;               /* number of pts in buffer */
+    EdgeTableEntry *pWETE;      /* Winding Edge Table      */
+    ScanLineList *pSLL;         /* Current ScanLineList    */
+    DDXPointPtr ptsOut;         /* ptr to output buffers   */
+    int *width;
+    DDXPointRec FirstPoint[NUMPTSTOBUFFER];     /* the output buffers */
+    int FirstWidth[NUMPTSTOBUFFER];
+    EdgeTableEntry *pPrevAET;   /* previous AET entry      */
+    EdgeTable ET;               /* Edge Table header node  */
+    EdgeTableEntry AET;         /* Active ET header node   */
+    EdgeTableEntry *pETEs;      /* Edge Table Entries buff */
+    ScanLineListBlock SLLBlock; /* header for ScanLineList */
+    int fixWAET = 0;
+
+    if (count < 3)
+        return TRUE;
+
+    if (!(pETEs = malloc(sizeof(EdgeTableEntry) * count)))
+        return FALSE;
+    ptsOut = FirstPoint;
+    width = FirstWidth;
+    if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock)) {
+        free(pETEs);
+        return FALSE;
+    }
+    pSLL = ET.scanlines.next;
+
+    if (pgc->fillRule == EvenOddRule) {
+        /*
+         *  for each scanline
+         */
+        for (y = ET.ymin; y < ET.ymax; y++) {
+            /*
+             *  Add a new edge to the active edge table when we
+             *  get to the next edge.
+             */
+            if (pSLL && y == pSLL->scanline) {
+                miloadAET(&AET, pSLL->edgelist);
+                pSLL = pSLL->next;
+            }
+            pPrevAET = &AET;
+            pAET = AET.next;
+
+            /*
+             *  for each active edge
+             */
+            while (pAET) {
+                ptsOut->x = pAET->bres.minor;
+                ptsOut++->y = y;
+                *width++ = pAET->next->bres.minor - pAET->bres.minor;
+                nPts++;
+
+                /*
+                 *  send out the buffer when its full
+                 */
+                if (nPts == NUMPTSTOBUFFER) {
+                    (*pgc->ops->FillSpans) (dst, pgc,
+                                            nPts, FirstPoint, FirstWidth, 1);
+                    ptsOut = FirstPoint;
+                    width = FirstWidth;
+                    nPts = 0;
+                }
+                EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
+                EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
+            }
+            miInsertionSort(&AET);
+        }
+    }
+    else {                      /* default to WindingNumber */
+
+        /*
+         *  for each scanline
+         */
+        for (y = ET.ymin; y < ET.ymax; y++) {
+            /*
+             *  Add a new edge to the active edge table when we
+             *  get to the next edge.
+             */
+            if (pSLL && y == pSLL->scanline) {
+                miloadAET(&AET, pSLL->edgelist);
+                micomputeWAET(&AET);
+                pSLL = pSLL->next;
+            }
+            pPrevAET = &AET;
+            pAET = AET.next;
+            pWETE = pAET;
+
+            /*
+             *  for each active edge
+             */
+            while (pAET) {
+                /*
+                 *  if the next edge in the active edge table is
+                 *  also the next edge in the winding active edge
+                 *  table.
+                 */
+                if (pWETE == pAET) {
+                    ptsOut->x = pAET->bres.minor;
+                    ptsOut++->y = y;
+                    *width++ = pAET->nextWETE->bres.minor - pAET->bres.minor;
+                    nPts++;
+
+                    /*
+                     *  send out the buffer
+                     */
+                    if (nPts == NUMPTSTOBUFFER) {
+                        (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint,
+                                                FirstWidth, 1);
+                        ptsOut = FirstPoint;
+                        width = FirstWidth;
+                        nPts = 0;
+                    }
+
+                    pWETE = pWETE->nextWETE;
+                    while (pWETE != pAET)
+                        EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
+                    pWETE = pWETE->nextWETE;
+                }
+                EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
+            }
+
+            /*
+             *  reevaluate the Winding active edge table if we
+             *  just had to resort it or if we just exited an edge.
+             */
+            if (miInsertionSort(&AET) || fixWAET) {
+                micomputeWAET(&AET);
+                fixWAET = 0;
+            }
+        }
+    }
+
+    /*
+     *     Get any spans that we missed by buffering
+     */
+    (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint, FirstWidth, 1);
+    free(pETEs);
+    miFreeStorage(SLLBlock.next);
+    return TRUE;
+}
+
+/*
+ *  Draw polygons.  This routine translates the point by the origin if
+ *  pGC->miTranslate is non-zero, and calls to the appropriate routine to
+ *  actually scan convert the polygon.
+ */
 void
 miFillPolygon(DrawablePtr dst, GCPtr pgc,
               int shape, int mode, int count, DDXPointPtr pPts)
diff --git a/mi/mipolycon.c b/mi/mipolycon.c
deleted file mode 100644
index e831633..0000000
--- a/mi/mipolycon.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "gcstruct.h"
-#include "pixmap.h"
-#include "mi.h"
-#include "miscanfill.h"
-
-static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty);
-
-/*
- *     convexpoly.c
- *
- *     Written by Brian Kelleher; Dec. 1985.
- *
- *     Fill a convex polygon.  If the given polygon
- *     is not convex, then the result is undefined.
- *     The algorithm is to order the edges from smallest
- *     y to largest by partitioning the array into a left
- *     edge list and a right edge list.  The algorithm used
- *     to traverse each edge is an extension of Bresenham's
- *     line algorithm with y as the major axis.
- *     For a derivation of the algorithm, see the author of
- *     this code.
- */
-Bool
-miFillConvexPoly(DrawablePtr dst, GCPtr pgc, int count, /* number of points        */
-                 DDXPointPtr ptsIn      /* the points              */
-    )
-{
-    int xl = 0, xr = 0;         /* x vals of left and right edges */
-    int dl = 0, dr = 0;         /* decision variables             */
-    int ml = 0, m1l = 0;        /* left edge slope and slope+1    */
-    int mr = 0, m1r = 0;        /* right edge slope and slope+1   */
-    int incr1l = 0, incr2l = 0; /* left edge error increments     */
-    int incr1r = 0, incr2r = 0; /* right edge error increments    */
-    int dy;                     /* delta y                        */
-    int y;                      /* current scanline               */
-    int left, right;            /* indices to first endpoints     */
-    int i;                      /* loop counter                   */
-    int nextleft, nextright;    /* indices to second endpoints    */
-    DDXPointPtr ptsOut, FirstPoint;     /* output buffer               */
-    int *width, *FirstWidth;    /* output buffer                  */
-    int imin;                   /* index of smallest vertex (in y) */
-    int ymin;                   /* y-extents of polygon            */
-    int ymax;
-
-    /*
-     *  find leftx, bottomy, rightx, topy, and the index
-     *  of bottomy. Also translate the points.
-     */
-    imin = getPolyYBounds(ptsIn, count, &ymin, &ymax);
-
-    dy = ymax - ymin + 1;
-    if ((count < 3) || (dy < 0))
-        return TRUE;
-    ptsOut = FirstPoint = malloc(sizeof(DDXPointRec) * dy);
-    width = FirstWidth = malloc(sizeof(int) * dy);
-    if (!FirstPoint || !FirstWidth) {
-        free(FirstWidth);
-        free(FirstPoint);
-        return FALSE;
-    }
-
-    nextleft = nextright = imin;
-    y = ptsIn[nextleft].y;
-
-    /*
-     *  loop through all edges of the polygon
-     */
-    do {
-        /*
-         *  add a left edge if we need to
-         */
-        if (ptsIn[nextleft].y == y) {
-            left = nextleft;
-
-            /*
-             *  find the next edge, considering the end
-             *  conditions of the array.
-             */
-            nextleft++;
-            if (nextleft >= count)
-                nextleft = 0;
-
-            /*
-             *  now compute all of the random information
-             *  needed to run the iterative algorithm.
-             */
-            BRESINITPGON(ptsIn[nextleft].y - ptsIn[left].y,
-                         ptsIn[left].x, ptsIn[nextleft].x,
-                         xl, dl, ml, m1l, incr1l, incr2l);
-        }
-
-        /*
-         *  add a right edge if we need to
-         */
-        if (ptsIn[nextright].y == y) {
-            right = nextright;
-
-            /*
-             *  find the next edge, considering the end
-             *  conditions of the array.
-             */
-            nextright--;
-            if (nextright < 0)
-                nextright = count - 1;
-
-            /*
-             *  now compute all of the random information
-             *  needed to run the iterative algorithm.
-             */
-            BRESINITPGON(ptsIn[nextright].y - ptsIn[right].y,
-                         ptsIn[right].x, ptsIn[nextright].x,
-                         xr, dr, mr, m1r, incr1r, incr2r);
-        }
-
-        /*
-         *  generate scans to fill while we still have
-         *  a right edge as well as a left edge.
-         */
-        i = min(ptsIn[nextleft].y, ptsIn[nextright].y) - y;
-        /* in case we're called with non-convex polygon */
-        if (i < 0) {
-            free(FirstWidth);
-            free(FirstPoint);
-            return TRUE;
-        }
-        while (i-- > 0) {
-            ptsOut->y = y;
-
-            /*
-             *  reverse the edges if necessary
-             */
-            if (xl < xr) {
-                *(width++) = xr - xl;
-                (ptsOut++)->x = xl;
-            }
-            else {
-                *(width++) = xl - xr;
-                (ptsOut++)->x = xr;
-            }
-            y++;
-
-            /* increment down the edges */
-            BRESINCRPGON(dl, xl, ml, m1l, incr1l, incr2l);
-            BRESINCRPGON(dr, xr, mr, m1r, incr1r, incr2r);
-        }
-    } while (y != ymax);
-
-    /*
-     * Finally, fill the <remaining> spans
-     */
-    (*pgc->ops->FillSpans) (dst, pgc,
-                            ptsOut - FirstPoint, FirstPoint, FirstWidth, 1);
-    free(FirstWidth);
-    free(FirstPoint);
-    return TRUE;
-}
-
-/*
- *     Find the index of the point with the smallest y.
- */
-static int
-getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty)
-{
-    DDXPointPtr ptMin;
-    int ymin, ymax;
-    DDXPointPtr ptsStart = pts;
-
-    ptMin = pts;
-    ymin = ymax = (pts++)->y;
-
-    while (--n > 0) {
-        if (pts->y < ymin) {
-            ptMin = pts;
-            ymin = pts->y;
-        }
-        if (pts->y > ymax)
-            ymax = pts->y;
-
-        pts++;
-    }
-
-    *by = ymin;
-    *ty = ymax;
-    return ptMin - ptsStart;
-}
diff --git a/mi/mipolygen.c b/mi/mipolygen.c
deleted file mode 100644
index 2031b42..0000000
--- a/mi/mipolygen.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include "gcstruct.h"
-#include "miscanfill.h"
-#include "mipoly.h"
-#include "pixmap.h"
-#include "mi.h"
-
-/*
- *
- *     Written by Brian Kelleher;  Oct. 1985
- *
- *     Routine to fill a polygon.  Two fill rules are
- *     supported: frWINDING and frEVENODD.
- *
- *     See fillpoly.h for a complete description of the algorithm.
- */
-
-Bool
-miFillGeneralPoly(DrawablePtr dst, GCPtr pgc, int count,        /* number of points        */
-                  DDXPointPtr ptsIn     /* the points              */
-    )
-{
-    EdgeTableEntry *pAET;       /* the Active Edge Table   */
-    int y;                      /* the current scanline    */
-    int nPts = 0;               /* number of pts in buffer */
-    EdgeTableEntry *pWETE;      /* Winding Edge Table      */
-    ScanLineList *pSLL;         /* Current ScanLineList    */
-    DDXPointPtr ptsOut;         /* ptr to output buffers   */
-    int *width;
-    DDXPointRec FirstPoint[NUMPTSTOBUFFER];     /* the output buffers */
-    int FirstWidth[NUMPTSTOBUFFER];
-    EdgeTableEntry *pPrevAET;   /* previous AET entry      */
-    EdgeTable ET;               /* Edge Table header node  */
-    EdgeTableEntry AET;         /* Active ET header node   */
-    EdgeTableEntry *pETEs;      /* Edge Table Entries buff */
-    ScanLineListBlock SLLBlock; /* header for ScanLineList */
-    int fixWAET = 0;
-
-    if (count < 3)
-        return TRUE;
-
-    if (!(pETEs = malloc(sizeof(EdgeTableEntry) * count)))
-        return FALSE;
-    ptsOut = FirstPoint;
-    width = FirstWidth;
-    if (!miCreateETandAET(count, ptsIn, &ET, &AET, pETEs, &SLLBlock)) {
-        free(pETEs);
-        return FALSE;
-    }
-    pSLL = ET.scanlines.next;
-
-    if (pgc->fillRule == EvenOddRule) {
-        /*
-         *  for each scanline
-         */
-        for (y = ET.ymin; y < ET.ymax; y++) {
-            /*
-             *  Add a new edge to the active edge table when we
-             *  get to the next edge.
-             */
-            if (pSLL && y == pSLL->scanline) {
-                miloadAET(&AET, pSLL->edgelist);
-                pSLL = pSLL->next;
-            }
-            pPrevAET = &AET;
-            pAET = AET.next;
-
-            /*
-             *  for each active edge
-             */
-            while (pAET) {
-                ptsOut->x = pAET->bres.minor;
-                ptsOut++->y = y;
-                *width++ = pAET->next->bres.minor - pAET->bres.minor;
-                nPts++;
-
-                /*
-                 *  send out the buffer when its full
-                 */
-                if (nPts == NUMPTSTOBUFFER) {
-                    (*pgc->ops->FillSpans) (dst, pgc,
-                                            nPts, FirstPoint, FirstWidth, 1);
-                    ptsOut = FirstPoint;
-                    width = FirstWidth;
-                    nPts = 0;
-                }
-                EVALUATEEDGEEVENODD(pAET, pPrevAET, y)
-                    EVALUATEEDGEEVENODD(pAET, pPrevAET, y);
-            }
-            miInsertionSort(&AET);
-        }
-    }
-    else {                      /* default to WindingNumber */
-
-        /*
-         *  for each scanline
-         */
-        for (y = ET.ymin; y < ET.ymax; y++) {
-            /*
-             *  Add a new edge to the active edge table when we
-             *  get to the next edge.
-             */
-            if (pSLL && y == pSLL->scanline) {
-                miloadAET(&AET, pSLL->edgelist);
-                micomputeWAET(&AET);
-                pSLL = pSLL->next;
-            }
-            pPrevAET = &AET;
-            pAET = AET.next;
-            pWETE = pAET;
-
-            /*
-             *  for each active edge
-             */
-            while (pAET) {
-                /*
-                 *  if the next edge in the active edge table is
-                 *  also the next edge in the winding active edge
-                 *  table.
-                 */
-                if (pWETE == pAET) {
-                    ptsOut->x = pAET->bres.minor;
-                    ptsOut++->y = y;
-                    *width++ = pAET->nextWETE->bres.minor - pAET->bres.minor;
-                    nPts++;
-
-                    /*
-                     *  send out the buffer
-                     */
-                    if (nPts == NUMPTSTOBUFFER) {
-                        (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint,
-                                                FirstWidth, 1);
-                        ptsOut = FirstPoint;
-                        width = FirstWidth;
-                        nPts = 0;
-                    }
-
-                    pWETE = pWETE->nextWETE;
-                    while (pWETE != pAET)
-                        EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
-                    pWETE = pWETE->nextWETE;
-                }
-                EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET);
-            }
-
-            /*
-             *  reevaluate the Winding active edge table if we
-             *  just had to resort it or if we just exited an edge.
-             */
-            if (miInsertionSort(&AET) || fixWAET) {
-                micomputeWAET(&AET);
-                fixWAET = 0;
-            }
-        }
-    }
-
-    /*
-     *     Get any spans that we missed by buffering
-     */
-    (*pgc->ops->FillSpans) (dst, pgc, nPts, FirstPoint, FirstWidth, 1);
-    free(pETEs);
-    miFreeStorage(SLLBlock.next);
-    return TRUE;
-}
commit 7679afd4da8b86aed27e5916ba723116a3c8bb4a
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Sep 26 12:01:37 2014 -0400

    mi: Fold mifpolycon.c into miarc.c
    
    Also put mifpoly.h on a diet, and stop including it from places that
    don't need it.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index 9c3c02f..2305073 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -217,7 +217,6 @@ cat > sdksyms.c << EOF
 #include "micoord.h"
 #include "mifillarc.h"
 #include "mistruct.h"
-#include "mifpoly.h"
 #include "mioverlay.h"
 
 
diff --git a/mi/Makefile.am b/mi/Makefile.am
index 149dc06..d9139a3 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -24,7 +24,6 @@ libmi_la_SOURCES = 	\
 	mifillarc.c	\
 	mifillarc.h	\
 	mifillrct.c	\
-	mifpolycon.c	\
 	mifpoly.h	\
 	migc.c		\
 	migc.h		\
diff --git a/mi/miarc.c b/mi/miarc.c
index e55108a..7bbe5b3 100644
--- a/mi/miarc.c
+++ b/mi/miarc.c
@@ -63,6 +63,22 @@ SOFTWARE.
 #include "mifillarc.h"
 #include <X11/Xfuncproto.h>
 
+#define EPSILON	0.000001
+#define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON)
+#define UNEQUAL(a,b) (fabs((a) - (b)) > EPSILON)
+#define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y))
+#define SQSECANT 108.856472512142   /* 1/sin^2(11/2) - for 11o miter cutoff */
+
+/* Point with sub-pixel positioning. */
+typedef struct _SppPoint {
+    double x, y;
+} SppPointRec, *SppPointPtr;
+
+typedef struct _SppArc {
+    double x, y, width, height;
+    double angle1, angle2;
+} SppArcRec, *SppArcPtr;
+
 static double miDsin(double a);
 static double miDcos(double a);
 static double miDasin(double v);
@@ -1110,6 +1126,195 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
     }
 }
 
+/* Find the index of the point with the smallest y.also return the
+ * smallest and largest y */
+static int
+GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans, int *by, int *ty)
+{
+    SppPointPtr ptMin;
+    double ymin, ymax;
+    SppPointPtr ptsStart = pts;
+
+    ptMin = pts;
+    ymin = ymax = (pts++)->y;
+
+    while (--n > 0) {
+        if (pts->y < ymin) {
+            ptMin = pts;
+            ymin = pts->y;
+        }
+        if (pts->y > ymax)
+            ymax = pts->y;
+
+        pts++;
+    }
+
+    *by = ICEIL(ymin + yFtrans);
+    *ty = ICEIL(ymax + yFtrans - 1);
+    return ptMin - ptsStart;
+}
+
+/*
+ *	miFillSppPoly written by Todd Newman; April. 1987.
+ *
+ *	Fill a convex polygon.  If the given polygon
+ *	is not convex, then the result is undefined.
+ *	The algorithm is to order the edges from smallest
+ *	y to largest by partitioning the array into a left
+ *	edge list and a right edge list.  The algorithm used
+ *	to traverse each edge is digital differencing analyzer
+ *	line algorithm with y as the major axis. There's some funny linear
+ *	interpolation involved because of the subpixel postioning.
+ */
+static void
+miFillSppPoly(DrawablePtr dst, GCPtr pgc, int count,    /* number of points */
+              SppPointPtr ptsIn,        /* the points */
+              int xTrans, int yTrans,   /* Translate each point by this */
+              double xFtrans, double yFtrans    /* translate before conversion
+                                                   by this amount.  This provides
+                                                   a mechanism to match rounding
+                                                   errors with any shape that must
+                                                   meet the polygon exactly.
+                                                 */
+    )
+{
+    double xl = 0.0, xr = 0.0,  /* x vals of left and right edges */
+        ml = 0.0,               /* left edge slope */
+        mr = 0.0,               /* right edge slope */
+        dy,                     /* delta y */
+        i;                      /* loop counter */
+    int y,                      /* current scanline */
+     j, imin,                   /* index of vertex with smallest y */
+     ymin,                      /* y-extents of polygon */
+     ymax, *width, *FirstWidth, /* output buffer */
+    *Marked;                    /* set if this vertex has been used */
+    int left, right,            /* indices to first endpoints */
+     nextleft, nextright;       /* indices to second endpoints */
+    DDXPointPtr ptsOut, FirstPoint;     /* output buffer */
+
+    if (pgc->miTranslate) {
+        xTrans += dst->x;
+        yTrans += dst->y;
+    }
+
+    imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax);
+
+    y = ymax - ymin + 1;
+    if ((count < 3) || (y <= 0))
+        return;
+    ptsOut = FirstPoint = malloc(sizeof(DDXPointRec) * y);
+    width = FirstWidth = malloc(sizeof(int) * y);
+    Marked = malloc(sizeof(int) * count);
+
+    if (!ptsOut || !width || !Marked) {
+        free(Marked);
+        free(width);
+        free(ptsOut);
+        return;
+    }
+
+    for (j = 0; j < count; j++)
+        Marked[j] = 0;
+    nextleft = nextright = imin;
+    Marked[imin] = -1;
+    y = ICEIL(ptsIn[nextleft].y + yFtrans);
+
+    /*
+     *  loop through all edges of the polygon
+     */
+    do {
+        /* add a left edge if we need to */
+        if ((y > (ptsIn[nextleft].y + yFtrans) ||
+             ISEQUAL(y, ptsIn[nextleft].y + yFtrans)) &&
+            Marked[nextleft] != 1) {
+            Marked[nextleft]++;
+            left = nextleft++;
+
+            /* find the next edge, considering the end conditions */
+            if (nextleft >= count)
+                nextleft = 0;
+
+            /* now compute the starting point and slope */
+            dy = ptsIn[nextleft].y - ptsIn[left].y;
+            if (dy != 0.0) {
+                ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy;
+                dy = y - (ptsIn[left].y + yFtrans);
+                xl = (ptsIn[left].x + xFtrans) + ml * max(dy, 0);
+            }
+        }
+
+        /* add a right edge if we need to */
+        if ((y > ptsIn[nextright].y + yFtrans) ||
+            (ISEQUAL(y, ptsIn[nextright].y + yFtrans)
+             && Marked[nextright] != 1)) {
+            Marked[nextright]++;
+            right = nextright--;
+
+            /* find the next edge, considering the end conditions */
+            if (nextright < 0)
+                nextright = count - 1;
+
+            /* now compute the starting point and slope */
+            dy = ptsIn[nextright].y - ptsIn[right].y;
+            if (dy != 0.0) {
+                mr = (ptsIn[nextright].x - ptsIn[right].x) / dy;
+                dy = y - (ptsIn[right].y + yFtrans);
+                xr = (ptsIn[right].x + xFtrans) + mr * max(dy, 0);
+            }
+        }
+
+        /*
+         *  generate scans to fill while we still have
+         *  a right edge as well as a left edge.
+         */
+        i = (min(ptsIn[nextleft].y, ptsIn[nextright].y) + yFtrans) - y;
+
+        if (i < EPSILON) {
+            if (Marked[nextleft] && Marked[nextright]) {
+                /* Arrgh, we're trapped! (no more points)
+                 * Out, we've got to get out of here before this decadence saps
+                 * our will completely! */
+                break;
+            }
+            continue;
+        }
+        else {
+            j = (int) i;
+            if (!j)
+                j++;
+        }
+        while (j > 0) {
+            int cxl, cxr;
+
+            ptsOut->y = (y) + yTrans;
+
+            cxl = ICEIL(xl);
+            cxr = ICEIL(xr);
+            /* reverse the edges if necessary */
+            if (xl < xr) {
+                *(width++) = cxr - cxl;
+                (ptsOut++)->x = cxl + xTrans;
+            }
+            else {
+                *(width++) = cxl - cxr;
+                (ptsOut++)->x = cxr + xTrans;
+            }
+            y++;
+
+            /* increment down the edges */
+            xl += ml;
+            xr += mr;
+            j--;
+        }
+    } while (y <= ymax);
+
+    /* Finally, fill the spans we've collected */
+    (*pgc->ops->FillSpans) (dst, pgc,
+                            ptsOut - FirstPoint, FirstPoint, FirstWidth, 1);
+    free(Marked);
+    free(FirstWidth);
+    free(FirstPoint);
+}
 static double
 angleBetween(SppPointRec center, SppPointRec point1, SppPointRec point2)
 {
diff --git a/mi/midash.c b/mi/midash.c
index 78cbaf2..50b0fbe 100644
--- a/mi/midash.c
+++ b/mi/midash.c
@@ -49,7 +49,6 @@ SOFTWARE.
 
 #include "regionstr.h"
 #include "mistruct.h"
-#include "mifpoly.h"
 
 void
 miStepDash(int dist,            /* distance to step */
diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index 9a5e785..246d70f 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -36,7 +36,6 @@ Author:  Bob Scheifler, MIT X Consortium
 #include "regionstr.h"
 #include "gcstruct.h"
 #include "pixmapstr.h"
-#include "mifpoly.h"
 #include "mi.h"
 #include "mifillarc.h"
 
diff --git a/mi/mifpoly.h b/mi/mifpoly.h
index 4b27d1c..9304c6f 100644
--- a/mi/mifpoly.h
+++ b/mi/mifpoly.h
@@ -49,24 +49,6 @@ SOFTWARE.
 
 #include <X11/Xfuncproto.h>
 
-#define EPSILON	0.000001
-#define ISEQUAL(a,b) (fabs((a) - (b)) <= EPSILON)
-#define UNEQUAL(a,b) (fabs((a) - (b)) > EPSILON)
-#define WITHINHALF(a, b) (((a) - (b) > 0.0) ? (a) - (b) < 0.5 : \
-					     (b) - (a) <= 0.5)
-#define ROUNDTOINT(x)   ((int) (((x) > 0.0) ? ((x) + 0.5) : ((x) - 0.5)))
-#define ISZERO(x) 	(fabs((x)) <= EPSILON)
-#define PTISEQUAL(a,b) (ISEQUAL(a.x,b.x) && ISEQUAL(a.y,b.y))
-#define PTUNEQUAL(a,b) (UNEQUAL(a.x,b.x) || UNEQUAL(a.y,b.y))
-#define PtEqual(a, b) (((a).x == (b).x) && ((a).y == (b).y))
-
-#define NotEnd		0
-#define FirstEnd	1
-#define SecondEnd	2
-
-#define SQSECANT 108.856472512142       /* 1/sin^2(11/2) - for 11o miter cutoff */
-#define D2SECANT 5.21671526231167       /* 1/2*sin(11/2) - max extension per width */
-
 static _X_INLINE int
 ICEIL(double x)
 {
@@ -75,27 +57,4 @@ ICEIL(double x)
     return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp + 1;
 }
 
-/* Point with sub-pixel positioning.  In this case we use doubles, but
- * see mifpolycon.c for other suggestions 
- */
-typedef struct _SppPoint {
-    double x, y;
-} SppPointRec, *SppPointPtr;
-
-typedef struct _SppArc {
-    double x, y, width, height;
-    double angle1, angle2;
-} SppArcRec, *SppArcPtr;
-
-/* mifpolycon.c */
-
-extern void miFillSppPoly(DrawablePtr /*dst */ ,
-                          GCPtr /*pgc */ ,
-                          int /*count */ ,
-                          SppPointPtr /*ptsIn */ ,
-                          int /*xTrans */ ,
-                          int /*yTrans */ ,
-                          double /*xFtrans */ ,
-                          double      /*yFtrans */);
-
 #endif                          /* __MIFPOLY_H__ */
diff --git a/mi/mifpolycon.c b/mi/mifpolycon.c
deleted file mode 100644
index b133731..0000000
--- a/mi/mifpolycon.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/***********************************************************
-
-Copyright 1987, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <math.h>
-#include <X11/X.h>
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "pixmapstr.h"
-#include "mifpoly.h"
-
-static int GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans,
-                           int *by, int *ty);
-
-/*
- *	Written by Todd Newman; April. 1987.
- *
- *	Fill a convex polygon.  If the given polygon
- *	is not convex, then the result is undefined.
- *	The algorithm is to order the edges from smallest
- *	y to largest by partitioning the array into a left
- *	edge list and a right edge list.  The algorithm used
- *	to traverse each edge is digital differencing analyzer
- *	line algorithm with y as the major axis. There's some funny linear
- *	interpolation involved because of the subpixel postioning.
- */
-void
-miFillSppPoly(DrawablePtr dst, GCPtr pgc, int count,    /* number of points */
-              SppPointPtr ptsIn,        /* the points */
-              int xTrans, int yTrans,   /* Translate each point by this */
-              double xFtrans, double yFtrans    /* translate before conversion
-                                                   by this amount.  This provides
-                                                   a mechanism to match rounding
-                                                   errors with any shape that must
-                                                   meet the polygon exactly.
-                                                 */
-    )
-{
-    double xl = 0.0, xr = 0.0,  /* x vals of left and right edges */
-        ml = 0.0,               /* left edge slope */
-        mr = 0.0,               /* right edge slope */
-        dy,                     /* delta y */
-        i;                      /* loop counter */
-    int y,                      /* current scanline */
-     j, imin,                   /* index of vertex with smallest y */
-     ymin,                      /* y-extents of polygon */
-     ymax, *width, *FirstWidth, /* output buffer */
-    *Marked;                    /* set if this vertex has been used */
-    int left, right,            /* indices to first endpoints */
-     nextleft, nextright;       /* indices to second endpoints */
-    DDXPointPtr ptsOut, FirstPoint;     /* output buffer */
-
-    if (pgc->miTranslate) {
-        xTrans += dst->x;
-        yTrans += dst->y;
-    }
-
-    imin = GetFPolyYBounds(ptsIn, count, yFtrans, &ymin, &ymax);
-
-    y = ymax - ymin + 1;
-    if ((count < 3) || (y <= 0))
-        return;
-    ptsOut = FirstPoint = malloc(sizeof(DDXPointRec) * y);
-    width = FirstWidth = malloc(sizeof(int) * y);
-    Marked = malloc(sizeof(int) * count);
-
-    if (!ptsOut || !width || !Marked) {
-        free(Marked);
-        free(width);
-        free(ptsOut);
-        return;
-    }
-
-    for (j = 0; j < count; j++)
-        Marked[j] = 0;
-    nextleft = nextright = imin;
-    Marked[imin] = -1;
-    y = ICEIL(ptsIn[nextleft].y + yFtrans);
-
-    /*
-     *  loop through all edges of the polygon
-     */
-    do {
-        /* add a left edge if we need to */
-        if ((y > (ptsIn[nextleft].y + yFtrans) ||
-             ISEQUAL(y, ptsIn[nextleft].y + yFtrans)) &&
-            Marked[nextleft] != 1) {
-            Marked[nextleft]++;
-            left = nextleft++;
-
-            /* find the next edge, considering the end conditions */
-            if (nextleft >= count)
-                nextleft = 0;
-
-            /* now compute the starting point and slope */
-            dy = ptsIn[nextleft].y - ptsIn[left].y;
-            if (dy != 0.0) {
-                ml = (ptsIn[nextleft].x - ptsIn[left].x) / dy;
-                dy = y - (ptsIn[left].y + yFtrans);
-                xl = (ptsIn[left].x + xFtrans) + ml * max(dy, 0);
-            }
-        }
-
-        /* add a right edge if we need to */
-        if ((y > ptsIn[nextright].y + yFtrans) ||
-            (ISEQUAL(y, ptsIn[nextright].y + yFtrans)
-             && Marked[nextright] != 1)) {
-            Marked[nextright]++;
-            right = nextright--;
-
-            /* find the next edge, considering the end conditions */
-            if (nextright < 0)
-                nextright = count - 1;
-
-            /* now compute the starting point and slope */
-            dy = ptsIn[nextright].y - ptsIn[right].y;
-            if (dy != 0.0) {
-                mr = (ptsIn[nextright].x - ptsIn[right].x) / dy;
-                dy = y - (ptsIn[right].y + yFtrans);
-                xr = (ptsIn[right].x + xFtrans) + mr * max(dy, 0);
-            }
-        }
-
-        /*
-         *  generate scans to fill while we still have
-         *  a right edge as well as a left edge.
-         */
-        i = (min(ptsIn[nextleft].y, ptsIn[nextright].y) + yFtrans) - y;
-
-        if (i < EPSILON) {
-            if (Marked[nextleft] && Marked[nextright]) {
-                /* Arrgh, we're trapped! (no more points) 
-                 * Out, we've got to get out of here before this decadence saps
-                 * our will completely! */
-                break;
-            }
-            continue;
-        }
-        else {
-            j = (int) i;
-            if (!j)
-                j++;
-        }
-        while (j > 0) {
-            int cxl, cxr;
-
-            ptsOut->y = (y) + yTrans;
-
-            cxl = ICEIL(xl);
-            cxr = ICEIL(xr);
-            /* reverse the edges if necessary */
-            if (xl < xr) {
-                *(width++) = cxr - cxl;
-                (ptsOut++)->x = cxl + xTrans;
-            }
-            else {
-                *(width++) = cxl - cxr;
-                (ptsOut++)->x = cxr + xTrans;
-            }
-            y++;
-
-            /* increment down the edges */
-            xl += ml;
-            xr += mr;
-            j--;
-        }
-    } while (y <= ymax);
-
-    /* Finally, fill the spans we've collected */
-    (*pgc->ops->FillSpans) (dst, pgc,
-                            ptsOut - FirstPoint, FirstPoint, FirstWidth, 1);
-    free(Marked);
-    free(FirstWidth);
-    free(FirstPoint);
-}
-
-/* Find the index of the point with the smallest y.also return the
- * smallest and largest y */
-static
-    int
-GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans, int *by, int *ty)
-{
-    SppPointPtr ptMin;
-    double ymin, ymax;
-    SppPointPtr ptsStart = pts;
-
-    ptMin = pts;
-    ymin = ymax = (pts++)->y;
-
-    while (--n > 0) {
-        if (pts->y < ymin) {
-            ptMin = pts;
-            ymin = pts->y;
-        }
-        if (pts->y > ymax)
-            ymax = pts->y;
-
-        pts++;
-    }
-
-    *by = ICEIL(ymin + yFtrans);
-    *ty = ICEIL(ymax + yFtrans - 1);
-    return ptMin - ptsStart;
-}
commit f307ef10f4c33da4b5ae59800931741b0a431d75
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Jul 21 17:22:07 2014 -0400

    mi: Fold mispans.c into miwideline.c
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index c2a1942..9c3c02f 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -216,7 +216,6 @@ cat > sdksyms.c << EOF
 #include "mizerarc.h"
 #include "micoord.h"
 #include "mifillarc.h"
-#include "mispans.h"
 #include "mistruct.h"
 #include "mifpoly.h"
 #include "mioverlay.h"
diff --git a/mi/Makefile.am b/mi/Makefile.am
index 4466f69..149dc06 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -47,8 +47,6 @@ libmi_la_SOURCES = 	\
 	mipushpxl.c	\
 	miscanfill.h	\
 	miscrinit.c	\
-	mispans.c	\
-	mispans.h	\
 	misprite.c	\
 	misprite.h	\
 	mistruct.h	\
diff --git a/mi/mispans.c b/mi/mispans.c
deleted file mode 100644
index 11c8a43..0000000
--- a/mi/mispans.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/***********************************************************
-
-Copyright 1989, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "misc.h"
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "mispans.h"
-
-/*
-
-These routines maintain lists of Spans, in order to implement the
-``touch-each-pixel-once'' rules of wide lines and arcs.
-
-Written by Joel McCormack, Summer 1989.
-
-*/
-
-void
-miInitSpanGroup(SpanGroup * spanGroup)
-{
-    spanGroup->size = 0;
-    spanGroup->count = 0;
-    spanGroup->group = NULL;
-    spanGroup->ymin = MAXSHORT;
-    spanGroup->ymax = MINSHORT;
-}                               /* InitSpanGroup */
-
-#define YMIN(spans) (spans->points[0].y)
-#define YMAX(spans)  (spans->points[spans->count-1].y)
-
-static void
-miSubtractSpans(SpanGroup * spanGroup, Spans * sub)
-{
-    int i, subCount, spansCount;
-    int ymin, ymax, xmin, xmax;
-    Spans *spans;
-    DDXPointPtr subPt, spansPt;
-    int *subWid, *spansWid;
-    int extra;
-
-    ymin = YMIN(sub);
-    ymax = YMAX(sub);
-    spans = spanGroup->group;
-    for (i = spanGroup->count; i; i--, spans++) {
-        if (YMIN(spans) <= ymax && ymin <= YMAX(spans)) {
-            subCount = sub->count;
-            subPt = sub->points;
-            subWid = sub->widths;
-            spansCount = spans->count;
-            spansPt = spans->points;
-            spansWid = spans->widths;
-            extra = 0;
-            for (;;) {
-                while (spansCount && spansPt->y < subPt->y) {
-                    spansPt++;
-                    spansWid++;
-                    spansCount--;
-                }
-                if (!spansCount)
-                    break;
-                while (subCount && subPt->y < spansPt->y) {
-                    subPt++;
-                    subWid++;
-                    subCount--;
-                }
-                if (!subCount)
-                    break;
-                if (subPt->y == spansPt->y) {
-                    xmin = subPt->x;
-                    xmax = xmin + *subWid;
-                    if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax) {
-                        ;
-                    }
-                    else if (xmin <= spansPt->x) {
-                        if (xmax >= spansPt->x + *spansWid) {
-                            memmove(spansPt, spansPt + 1,
-                                    sizeof *spansPt * (spansCount - 1));
-                            memmove(spansWid, spansWid + 1,
-                                    sizeof *spansWid * (spansCount - 1));
-                            spansPt--;
-                            spansWid--;
-                            spans->count--;
-                            extra++;
-                        }
-                        else {
-                            *spansWid = *spansWid - (xmax - spansPt->x);
-                            spansPt->x = xmax;
-                        }
-                    }
-                    else {
-                        if (xmax >= spansPt->x + *spansWid) {
-                            *spansWid = xmin - spansPt->x;
-                        }
-                        else {
-                            if (!extra) {
-                                DDXPointPtr newPt;
-                                int *newwid;
-
-#define EXTRA 8
-                                newPt =
-                                    (DDXPointPtr) realloc(spans->points,
-                                                          (spans->count +
-                                                           EXTRA) *
-                                                          sizeof(DDXPointRec));
-                                if (!newPt)
-                                    break;
-                                spansPt = newPt + (spansPt - spans->points);
-                                spans->points = newPt;
-                                newwid =
-                                    (int *) realloc(spans->widths,
-                                                    (spans->count +
-                                                     EXTRA) * sizeof(int));
-                                if (!newwid)
-                                    break;
-                                spansWid = newwid + (spansWid - spans->widths);
-                                spans->widths = newwid;
-                                extra = EXTRA;
-                            }
-                            memmove(spansPt + 1, spansPt,
-                                    sizeof *spansPt * (spansCount));
-                            memmove(spansWid + 1, spansWid,
-                                    sizeof *spansWid * (spansCount));
-                            spans->count++;
-                            extra--;
-                            *spansWid = xmin - spansPt->x;
-                            spansWid++;
-                            spansPt++;
-                            *spansWid = *spansWid - (xmax - spansPt->x);
-                            spansPt->x = xmax;
-                        }
-                    }
-                }
-                spansPt++;
-                spansWid++;
-                spansCount--;
-            }
-        }
-    }
-}
-
-void
-miAppendSpans(SpanGroup * spanGroup, SpanGroup * otherGroup, Spans * spans)
-{
-    int ymin, ymax;
-    int spansCount;
-
-    spansCount = spans->count;
-    if (spansCount > 0) {
-        if (spanGroup->size == spanGroup->count) {
-            spanGroup->size = (spanGroup->size + 8) * 2;
-            spanGroup->group = (Spans *)
-                realloc(spanGroup->group, sizeof(Spans) * spanGroup->size);
-        }
-
-        spanGroup->group[spanGroup->count] = *spans;
-        (spanGroup->count)++;
-        ymin = spans->points[0].y;
-        if (ymin < spanGroup->ymin)
-            spanGroup->ymin = ymin;
-        ymax = spans->points[spansCount - 1].y;
-        if (ymax > spanGroup->ymax)
-            spanGroup->ymax = ymax;
-        if (otherGroup && otherGroup->ymin < ymax && ymin < otherGroup->ymax) {
-            miSubtractSpans(otherGroup, spans);
-        }
-    }
-    else {
-        free(spans->points);
-        free(spans->widths);
-    }
-}                               /* AppendSpans */
-
-void
-miFreeSpanGroup(SpanGroup * spanGroup)
-{
-    free(spanGroup->group);
-}
-
-static void
-QuickSortSpansX(DDXPointRec points[], int widths[], int numSpans)
-{
-    int x;
-    int i, j, m;
-    DDXPointPtr r;
-
-/* Always called with numSpans > 1 */
-/* Sorts only by x, as all y should be the same */
-
-#define ExchangeSpans(a, b)				    \
-{							    \
-    DDXPointRec 	tpt;				    \
-    int    		tw;				    \
-							    \
-    tpt = points[a]; points[a] = points[b]; points[b] = tpt;    \
-    tw = widths[a]; widths[a] = widths[b]; widths[b] = tw;  \
-}
-
-    do {
-        if (numSpans < 9) {
-            /* Do insertion sort */
-            int xprev;
-
-            xprev = points[0].x;
-            i = 1;
-            do {                /* while i != numSpans */
-                x = points[i].x;
-                if (xprev > x) {
-                    /* points[i] is out of order.  Move into proper location. */
-                    DDXPointRec tpt;
-                    int tw, k;
-
-                    for (j = 0; x >= points[j].x; j++) {
-                    }
-                    tpt = points[i];
-                    tw = widths[i];
-                    for (k = i; k != j; k--) {
-                        points[k] = points[k - 1];
-                        widths[k] = widths[k - 1];
-                    }
-                    points[j] = tpt;
-                    widths[j] = tw;
-                    x = points[i].x;
-                }               /* if out of order */
-                xprev = x;
-                i++;
-            } while (i != numSpans);
-            return;
-        }
-
-        /* Choose partition element, stick in location 0 */
-        m = numSpans / 2;
-        if (points[m].x > points[0].x)
-            ExchangeSpans(m, 0);
-        if (points[m].x > points[numSpans - 1].x)
-            ExchangeSpans(m, numSpans - 1);
-        if (points[m].x > points[0].x)
-            ExchangeSpans(m, 0);
-        x = points[0].x;
-
-        /* Partition array */
-        i = 0;
-        j = numSpans;
-        do {
-            r = &(points[i]);
-            do {
-                r++;
-                i++;
-            } while (i != numSpans && r->x < x);
-            r = &(points[j]);
-            do {
-                r--;
-                j--;
-            } while (x < r->x);
-            if (i < j)
-                ExchangeSpans(i, j);
-        } while (i < j);
-
-        /* Move partition element back to middle */
-        ExchangeSpans(0, j);
-
-        /* Recurse */
-        if (numSpans - j - 1 > 1)
-            QuickSortSpansX(&points[j + 1], &widths[j + 1], numSpans - j - 1);
-        numSpans = j;
-    } while (numSpans > 1);
-}                               /* QuickSortSpans */
-
-static int
-UniquifySpansX(Spans * spans, DDXPointRec * newPoints, int *newWidths)
-{
-    int newx1, newx2, oldpt, i, y;
-    DDXPointRec *oldPoints;
-    int *oldWidths;
-    int *startNewWidths;
-
-/* Always called with numSpans > 1 */
-/* Uniquify the spans, and stash them into newPoints and newWidths.  Return the
-   number of unique spans. */
-
-    startNewWidths = newWidths;
-
-    oldPoints = spans->points;
-    oldWidths = spans->widths;
-
-    y = oldPoints->y;
-    newx1 = oldPoints->x;
-    newx2 = newx1 + *oldWidths;
-
-    for (i = spans->count - 1; i != 0; i--) {
-        oldPoints++;
-        oldWidths++;
-        oldpt = oldPoints->x;
-        if (oldpt > newx2) {
-            /* Write current span, start a new one */
-            newPoints->x = newx1;
-            newPoints->y = y;
-            *newWidths = newx2 - newx1;
-            newPoints++;
-            newWidths++;
-            newx1 = oldpt;
-            newx2 = oldpt + *oldWidths;
-        }
-        else {
-            /* extend current span, if old extends beyond new */
-            oldpt = oldpt + *oldWidths;
-            if (oldpt > newx2)
-                newx2 = oldpt;
-        }
-    }                           /* for */
-
-    /* Write final span */
-    newPoints->x = newx1;
-    *newWidths = newx2 - newx1;
-    newPoints->y = y;
-
-    return (newWidths - startNewWidths) + 1;
-}                               /* UniquifySpansX */
-
-static void
-miDisposeSpanGroup(SpanGroup * spanGroup)
-{
-    int i;
-    Spans *spans;
-
-    for (i = 0; i < spanGroup->count; i++) {
-        spans = spanGroup->group + i;
-        free(spans->points);
-        free(spans->widths);
-    }
-}
-
-void
-miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
-{
-    int i;
-    Spans *spans;
-    Spans *yspans;
-    int *ysizes;
-    int ymin, ylength;
-
-    /* Outgoing spans for one big call to FillSpans */
-    DDXPointPtr points;
-    int *widths;
-    int count;
-
-    if (spanGroup->count == 0)
-        return;
-
-    if (spanGroup->count == 1) {
-        /* Already should be sorted, unique */
-        spans = spanGroup->group;
-        (*pGC->ops->FillSpans)
-            (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE);
-        free(spans->points);
-        free(spans->widths);
-    }
-    else {
-        /* Yuck.  Gross.  Radix sort into y buckets, then sort x and uniquify */
-        /* This seems to be the fastest thing to do.  I've tried sorting on
-           both x and y at the same time rather than creating into all those
-           y buckets, but it was somewhat slower. */
-
-        ymin = spanGroup->ymin;
-        ylength = spanGroup->ymax - ymin + 1;
-
-        /* Allocate Spans for y buckets */
-        yspans = malloc(ylength * sizeof(Spans));
-        ysizes = malloc(ylength * sizeof(int));
-
-        if (!yspans || !ysizes) {
-            free(yspans);
-            free(ysizes);
-            miDisposeSpanGroup(spanGroup);
-            return;
-        }
-
-        for (i = 0; i != ylength; i++) {
-            ysizes[i] = 0;
-            yspans[i].count = 0;
-            yspans[i].points = NULL;
-            yspans[i].widths = NULL;
-        }
-
-        /* Go through every single span and put it into the correct bucket */
-        count = 0;
-        for (i = 0, spans = spanGroup->group;
-             i != spanGroup->count; i++, spans++) {
-            int index;
-            int j;
-
-            for (j = 0, points = spans->points, widths = spans->widths;
-                 j != spans->count; j++, points++, widths++) {
-                index = points->y - ymin;
-                if (index >= 0 && index < ylength) {
-                    Spans *newspans = &(yspans[index]);
-
-                    if (newspans->count == ysizes[index]) {
-                        DDXPointPtr newpoints;
-                        int *newwidths;
-
-                        ysizes[index] = (ysizes[index] + 8) * 2;
-                        newpoints = (DDXPointPtr) realloc(newspans->points,
-                                                          ysizes[index] *
-                                                          sizeof(DDXPointRec));
-                        newwidths =
-                            (int *) realloc(newspans->widths,
-                                            ysizes[index] * sizeof(int));
-                        if (!newpoints || !newwidths) {
-                            for (i = 0; i < ylength; i++) {
-                                free(yspans[i].points);
-                                free(yspans[i].widths);
-                            }
-                            free(yspans);
-                            free(ysizes);
-                            free(newpoints);
-                            free(newwidths);
-                            miDisposeSpanGroup(spanGroup);
-                            return;
-                        }
-                        newspans->points = newpoints;
-                        newspans->widths = newwidths;
-                    }
-                    newspans->points[newspans->count] = *points;
-                    newspans->widths[newspans->count] = *widths;
-                    (newspans->count)++;
-                }               /* if y value of span in range */
-            }                   /* for j through spans */
-            count += spans->count;
-            free(spans->points);
-            spans->points = NULL;
-            free(spans->widths);
-            spans->widths = NULL;
-        }                       /* for i thorough Spans */
-
-        /* Now sort by x and uniquify each bucket into the final array */
-        points = malloc(count * sizeof(DDXPointRec));
-        widths = malloc(count * sizeof(int));
-        if (!points || !widths) {
-            for (i = 0; i < ylength; i++) {
-                free(yspans[i].points);
-                free(yspans[i].widths);
-            }
-            free(yspans);
-            free(ysizes);
-            free(points);
-            free(widths);
-            return;
-        }
-        count = 0;
-        for (i = 0; i != ylength; i++) {
-            int ycount = yspans[i].count;
-
-            if (ycount > 0) {
-                if (ycount > 1) {
-                    QuickSortSpansX(yspans[i].points, yspans[i].widths, ycount);
-                    count += UniquifySpansX
-                        (&(yspans[i]), &(points[count]), &(widths[count]));
-                }
-                else {
-                    points[count] = yspans[i].points[0];
-                    widths[count] = yspans[i].widths[0];
-                    count++;
-                }
-                free(yspans[i].points);
-                free(yspans[i].widths);
-            }
-        }
-
-        (*pGC->ops->FillSpans) (pDraw, pGC, count, points, widths, TRUE);
-        free(points);
-        free(widths);
-        free(yspans);
-        free(ysizes);           /* use (DE)xalloc for these? */
-    }
-
-    spanGroup->count = 0;
-    spanGroup->ymin = MAXSHORT;
-    spanGroup->ymax = MINSHORT;
-}
diff --git a/mi/mispans.h b/mi/mispans.h
deleted file mode 100644
index 7c3fcef..0000000
--- a/mi/mispans.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/***********************************************************
-
-Copyright 1989, 1998  The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
-
-                        All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its 
-documentation for any purpose and without fee is hereby granted, 
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in 
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.  
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-
-#ifndef MISPANS_H
-#define MISPANS_H
-
-typedef struct {
-    int count;                  /* number of spans                  */
-    DDXPointPtr points;         /* pointer to list of start points  */
-    int *widths;                /* pointer to list of widths        */
-} Spans;
-
-typedef struct {
-    int size;                   /* Total number of *Spans allocated     */
-    int count;                  /* Number of *Spans actually in group   */
-    Spans *group;               /* List of Spans                        */
-    int ymin, ymax;             /* Min, max y values encountered        */
-} SpanGroup;
-
-/* Initialize SpanGroup.  MUST BE DONE before use. */
-extern void miInitSpanGroup(SpanGroup *       /*spanGroup */);
-
-/* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
-extern void miAppendSpans(SpanGroup * /*spanGroup */ ,
-                          SpanGroup * /*otherGroup */ ,
-                          Spans *     /*spans */);
-
-/* Paint a span group, insuring that each pixel is painted at most once */
-extern void miFillUniqueSpanGroup(DrawablePtr /*pDraw */ ,
-                                  GCPtr /*pGC */ ,
-                                  SpanGroup * /*spanGroup */);
-
-/* Free up data in a span group.  MUST BE DONE or you'll suffer memory leaks */
-extern void miFreeSpanGroup(SpanGroup *       /*spanGroup */);
-
-/* Rops which must use span groups */
-#define miSpansCarefulRop(rop)	(((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
-#define miSpansEasyRop(rop)	(!miSpansCarefulRop(rop))
-
-#endif                          /* MISPANS_H */
diff --git a/mi/miwideline.c b/mi/miwideline.c
index 295a05a..452d74f 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -24,6 +24,25 @@ not be used in advertising or otherwise to promote the sale, use or
 other dealings in this Software without prior written authorization
 from The Open Group.
 
+Copyright 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Digital not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
 */
 
 /* Author:  Keith Packard, MIT X Consortium */
@@ -52,6 +71,505 @@ from The Open Group.
 #include "miwideline.h"
 #include "mi.h"
 
+#if 0
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "misc.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#endif
+
+typedef struct {
+    int count;                  /* number of spans                  */
+    DDXPointPtr points;         /* pointer to list of start points  */
+    int *widths;                /* pointer to list of widths        */
+} Spans;
+
+typedef struct {
+    int size;                   /* Total number of *Spans allocated     */
+    int count;                  /* Number of *Spans actually in group   */
+    Spans *group;               /* List of Spans                        */
+    int ymin, ymax;             /* Min, max y values encountered        */
+} SpanGroup;
+
+/* Rops which must use span groups */
+#define miSpansCarefulRop(rop)	(((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
+#define miSpansEasyRop(rop)	(!miSpansCarefulRop(rop))
+
+/*
+
+These routines maintain lists of Spans, in order to implement the
+``touch-each-pixel-once'' rules of wide lines and arcs.
+
+Written by Joel McCormack, Summer 1989.
+
+*/
+
+static void
+miInitSpanGroup(SpanGroup * spanGroup)
+{
+    spanGroup->size = 0;
+    spanGroup->count = 0;
+    spanGroup->group = NULL;
+    spanGroup->ymin = MAXSHORT;
+    spanGroup->ymax = MINSHORT;
+}                               /* InitSpanGroup */
+
+#define YMIN(spans) (spans->points[0].y)
+#define YMAX(spans)  (spans->points[spans->count-1].y)
+
+static void
+miSubtractSpans(SpanGroup * spanGroup, Spans * sub)
+{
+    int i, subCount, spansCount;
+    int ymin, ymax, xmin, xmax;
+    Spans *spans;
+    DDXPointPtr subPt, spansPt;
+    int *subWid, *spansWid;
+    int extra;
+
+    ymin = YMIN(sub);
+    ymax = YMAX(sub);
+    spans = spanGroup->group;
+    for (i = spanGroup->count; i; i--, spans++) {
+        if (YMIN(spans) <= ymax && ymin <= YMAX(spans)) {
+            subCount = sub->count;
+            subPt = sub->points;
+            subWid = sub->widths;
+            spansCount = spans->count;
+            spansPt = spans->points;
+            spansWid = spans->widths;
+            extra = 0;
+            for (;;) {
+                while (spansCount && spansPt->y < subPt->y) {
+                    spansPt++;
+                    spansWid++;
+                    spansCount--;
+                }
+                if (!spansCount)
+                    break;
+                while (subCount && subPt->y < spansPt->y) {
+                    subPt++;
+                    subWid++;
+                    subCount--;
+                }
+                if (!subCount)
+                    break;
+                if (subPt->y == spansPt->y) {
+                    xmin = subPt->x;
+                    xmax = xmin + *subWid;
+                    if (xmin >= spansPt->x + *spansWid || spansPt->x >= xmax) {
+                        ;
+                    }
+                    else if (xmin <= spansPt->x) {
+                        if (xmax >= spansPt->x + *spansWid) {
+                            memmove(spansPt, spansPt + 1,
+                                    sizeof *spansPt * (spansCount - 1));
+                            memmove(spansWid, spansWid + 1,
+                                    sizeof *spansWid * (spansCount - 1));
+                            spansPt--;
+                            spansWid--;
+                            spans->count--;
+                            extra++;
+                        }
+                        else {
+                            *spansWid = *spansWid - (xmax - spansPt->x);
+                            spansPt->x = xmax;
+                        }
+                    }
+                    else {
+                        if (xmax >= spansPt->x + *spansWid) {
+                            *spansWid = xmin - spansPt->x;
+                        }
+                        else {
+                            if (!extra) {
+                                DDXPointPtr newPt;
+                                int *newwid;
+
+#define EXTRA 8
+                                newPt =
+                                    (DDXPointPtr) realloc(spans->points,
+                                                          (spans->count +
+                                                           EXTRA) *
+                                                          sizeof(DDXPointRec));
+                                if (!newPt)
+                                    break;
+                                spansPt = newPt + (spansPt - spans->points);
+                                spans->points = newPt;
+                                newwid =
+                                    (int *) realloc(spans->widths,
+                                                    (spans->count +
+                                                     EXTRA) * sizeof(int));
+                                if (!newwid)
+                                    break;
+                                spansWid = newwid + (spansWid - spans->widths);
+                                spans->widths = newwid;
+                                extra = EXTRA;
+                            }
+                            memmove(spansPt + 1, spansPt,
+                                    sizeof *spansPt * (spansCount));
+                            memmove(spansWid + 1, spansWid,
+                                    sizeof *spansWid * (spansCount));
+                            spans->count++;
+                            extra--;
+                            *spansWid = xmin - spansPt->x;
+                            spansWid++;
+                            spansPt++;
+                            *spansWid = *spansWid - (xmax - spansPt->x);
+                            spansPt->x = xmax;
+                        }
+                    }
+                }
+                spansPt++;
+                spansWid++;
+                spansCount--;
+            }
+        }
+    }
+}
+
+static void
+miAppendSpans(SpanGroup * spanGroup, SpanGroup * otherGroup, Spans * spans)
+{
+    int ymin, ymax;
+    int spansCount;
+
+    spansCount = spans->count;
+    if (spansCount > 0) {
+        if (spanGroup->size == spanGroup->count) {
+            spanGroup->size = (spanGroup->size + 8) * 2;
+            spanGroup->group = (Spans *)
+                realloc(spanGroup->group, sizeof(Spans) * spanGroup->size);
+        }
+
+        spanGroup->group[spanGroup->count] = *spans;
+        (spanGroup->count)++;
+        ymin = spans->points[0].y;
+        if (ymin < spanGroup->ymin)
+            spanGroup->ymin = ymin;
+        ymax = spans->points[spansCount - 1].y;
+        if (ymax > spanGroup->ymax)
+            spanGroup->ymax = ymax;
+        if (otherGroup && otherGroup->ymin < ymax && ymin < otherGroup->ymax) {
+            miSubtractSpans(otherGroup, spans);
+        }
+    }
+    else {
+        free(spans->points);
+        free(spans->widths);
+    }
+}                               /* AppendSpans */
+
+static void
+miFreeSpanGroup(SpanGroup * spanGroup)
+{
+    free(spanGroup->group);
+}
+
+static void
+QuickSortSpansX(DDXPointRec points[], int widths[], int numSpans)
+{
+    int x;
+    int i, j, m;
+    DDXPointPtr r;
+
+/* Always called with numSpans > 1 */
+/* Sorts only by x, as all y should be the same */
+
+#define ExchangeSpans(a, b)				    \
+{							    \
+    DDXPointRec 	tpt;				    \
+    int    		tw;				    \
+							    \
+    tpt = points[a]; points[a] = points[b]; points[b] = tpt;    \
+    tw = widths[a]; widths[a] = widths[b]; widths[b] = tw;  \
+}
+
+    do {
+        if (numSpans < 9) {
+            /* Do insertion sort */
+            int xprev;
+
+            xprev = points[0].x;
+            i = 1;
+            do {                /* while i != numSpans */
+                x = points[i].x;
+                if (xprev > x) {
+                    /* points[i] is out of order.  Move into proper location. */
+                    DDXPointRec tpt;
+                    int tw, k;
+
+                    for (j = 0; x >= points[j].x; j++) {
+                    }
+                    tpt = points[i];
+                    tw = widths[i];
+                    for (k = i; k != j; k--) {
+                        points[k] = points[k - 1];
+                        widths[k] = widths[k - 1];
+                    }
+                    points[j] = tpt;
+                    widths[j] = tw;
+                    x = points[i].x;
+                }               /* if out of order */
+                xprev = x;
+                i++;
+            } while (i != numSpans);
+            return;
+        }
+
+        /* Choose partition element, stick in location 0 */
+        m = numSpans / 2;
+        if (points[m].x > points[0].x)
+            ExchangeSpans(m, 0);
+        if (points[m].x > points[numSpans - 1].x)
+            ExchangeSpans(m, numSpans - 1);
+        if (points[m].x > points[0].x)
+            ExchangeSpans(m, 0);
+        x = points[0].x;
+
+        /* Partition array */
+        i = 0;
+        j = numSpans;
+        do {
+            r = &(points[i]);
+            do {
+                r++;
+                i++;
+            } while (i != numSpans && r->x < x);
+            r = &(points[j]);
+            do {
+                r--;
+                j--;
+            } while (x < r->x);
+            if (i < j)
+                ExchangeSpans(i, j);
+        } while (i < j);
+
+        /* Move partition element back to middle */
+        ExchangeSpans(0, j);
+
+        /* Recurse */
+        if (numSpans - j - 1 > 1)
+            QuickSortSpansX(&points[j + 1], &widths[j + 1], numSpans - j - 1);
+        numSpans = j;
+    } while (numSpans > 1);
+}                               /* QuickSortSpans */
+
+static int
+UniquifySpansX(Spans * spans, DDXPointRec * newPoints, int *newWidths)
+{
+    int newx1, newx2, oldpt, i, y;
+    DDXPointRec *oldPoints;
+    int *oldWidths;
+    int *startNewWidths;
+
+/* Always called with numSpans > 1 */
+/* Uniquify the spans, and stash them into newPoints and newWidths.  Return the
+   number of unique spans. */
+
+    startNewWidths = newWidths;
+
+    oldPoints = spans->points;
+    oldWidths = spans->widths;
+
+    y = oldPoints->y;
+    newx1 = oldPoints->x;
+    newx2 = newx1 + *oldWidths;
+
+    for (i = spans->count - 1; i != 0; i--) {
+        oldPoints++;
+        oldWidths++;
+        oldpt = oldPoints->x;
+        if (oldpt > newx2) {
+            /* Write current span, start a new one */
+            newPoints->x = newx1;
+            newPoints->y = y;
+            *newWidths = newx2 - newx1;
+            newPoints++;
+            newWidths++;
+            newx1 = oldpt;
+            newx2 = oldpt + *oldWidths;
+        }
+        else {
+            /* extend current span, if old extends beyond new */
+            oldpt = oldpt + *oldWidths;
+            if (oldpt > newx2)
+                newx2 = oldpt;
+        }
+    }                           /* for */
+
+    /* Write final span */
+    newPoints->x = newx1;
+    *newWidths = newx2 - newx1;
+    newPoints->y = y;
+
+    return (newWidths - startNewWidths) + 1;
+}                               /* UniquifySpansX */
+
+static void
+miDisposeSpanGroup(SpanGroup * spanGroup)
+{
+    int i;
+    Spans *spans;
+
+    for (i = 0; i < spanGroup->count; i++) {
+        spans = spanGroup->group + i;
+        free(spans->points);
+        free(spans->widths);
+    }
+}
+
+static void
+miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup)
+{
+    int i;
+    Spans *spans;
+    Spans *yspans;
+    int *ysizes;
+    int ymin, ylength;
+
+    /* Outgoing spans for one big call to FillSpans */
+    DDXPointPtr points;
+    int *widths;
+    int count;
+
+    if (spanGroup->count == 0)
+        return;
+
+    if (spanGroup->count == 1) {
+        /* Already should be sorted, unique */
+        spans = spanGroup->group;
+        (*pGC->ops->FillSpans)
+            (pDraw, pGC, spans->count, spans->points, spans->widths, TRUE);
+        free(spans->points);
+        free(spans->widths);
+    }
+    else {
+        /* Yuck.  Gross.  Radix sort into y buckets, then sort x and uniquify */
+        /* This seems to be the fastest thing to do.  I've tried sorting on
+           both x and y at the same time rather than creating into all those
+           y buckets, but it was somewhat slower. */
+
+        ymin = spanGroup->ymin;
+        ylength = spanGroup->ymax - ymin + 1;
+
+        /* Allocate Spans for y buckets */
+        yspans = malloc(ylength * sizeof(Spans));
+        ysizes = malloc(ylength * sizeof(int));
+
+        if (!yspans || !ysizes) {
+            free(yspans);
+            free(ysizes);
+            miDisposeSpanGroup(spanGroup);
+            return;
+        }
+
+        for (i = 0; i != ylength; i++) {
+            ysizes[i] = 0;
+            yspans[i].count = 0;
+            yspans[i].points = NULL;
+            yspans[i].widths = NULL;
+        }
+
+        /* Go through every single span and put it into the correct bucket */
+        count = 0;
+        for (i = 0, spans = spanGroup->group;
+             i != spanGroup->count; i++, spans++) {
+            int index;
+            int j;
+
+            for (j = 0, points = spans->points, widths = spans->widths;
+                 j != spans->count; j++, points++, widths++) {
+                index = points->y - ymin;
+                if (index >= 0 && index < ylength) {
+                    Spans *newspans = &(yspans[index]);
+
+                    if (newspans->count == ysizes[index]) {
+                        DDXPointPtr newpoints;
+                        int *newwidths;
+
+                        ysizes[index] = (ysizes[index] + 8) * 2;
+                        newpoints = (DDXPointPtr) realloc(newspans->points,
+                                                          ysizes[index] *
+                                                          sizeof(DDXPointRec));
+                        newwidths =
+                            (int *) realloc(newspans->widths,
+                                            ysizes[index] * sizeof(int));
+                        if (!newpoints || !newwidths) {
+                            for (i = 0; i < ylength; i++) {
+                                free(yspans[i].points);
+                                free(yspans[i].widths);
+                            }
+                            free(yspans);
+                            free(ysizes);
+                            free(newpoints);
+                            free(newwidths);
+                            miDisposeSpanGroup(spanGroup);
+                            return;
+                        }
+                        newspans->points = newpoints;
+                        newspans->widths = newwidths;
+                    }
+                    newspans->points[newspans->count] = *points;
+                    newspans->widths[newspans->count] = *widths;
+                    (newspans->count)++;
+                }               /* if y value of span in range */
+            }                   /* for j through spans */
+            count += spans->count;
+            free(spans->points);
+            spans->points = NULL;
+            free(spans->widths);
+            spans->widths = NULL;
+        }                       /* for i thorough Spans */
+
+        /* Now sort by x and uniquify each bucket into the final array */
+        points = malloc(count * sizeof(DDXPointRec));
+        widths = malloc(count * sizeof(int));
+        if (!points || !widths) {
+            for (i = 0; i < ylength; i++) {
+                free(yspans[i].points);
+                free(yspans[i].widths);
+            }
+            free(yspans);
+            free(ysizes);
+            free(points);
+            free(widths);
+            return;
+        }
+        count = 0;
+        for (i = 0; i != ylength; i++) {
+            int ycount = yspans[i].count;
+
+            if (ycount > 0) {
+                if (ycount > 1) {
+                    QuickSortSpansX(yspans[i].points, yspans[i].widths, ycount);
+                    count += UniquifySpansX
+                        (&(yspans[i]), &(points[count]), &(widths[count]));
+                }
+                else {
+                    points[count] = yspans[i].points[0];
+                    widths[count] = yspans[i].widths[0];
+                    count++;
+                }
+                free(yspans[i].points);
+                free(yspans[i].widths);
+            }
+        }
+
+        (*pGC->ops->FillSpans) (pDraw, pGC, count, points, widths, TRUE);
+        free(points);
+        free(widths);
+        free(yspans);
+        free(ysizes);           /* use (DE)xalloc for these? */
+    }
+
+    spanGroup->count = 0;
+    spanGroup->ymin = MAXSHORT;
+    spanGroup->ymax = MINSHORT;
+}
+
 static Bool
 InitSpans(Spans * spans, size_t nspans)
 {
diff --git a/mi/miwideline.h b/mi/miwideline.h
index a9f2740..88bc3d6 100644
--- a/mi/miwideline.h
+++ b/mi/miwideline.h
@@ -28,7 +28,6 @@ from The Open Group.
 
 /* Author:  Keith Packard, MIT X Consortium */
 
-#include "mispans.h"
 #include "mifpoly.h"            /* for ICEIL */
 
 /*
commit 707965407a3c907058b89610e73e02989fd0b552
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 23 12:10:29 2014 -0400

    mi: Unexport arc fill implementation details
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/Makefile.am b/mi/Makefile.am
index b243029..4466f69 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libmi.la
 
 if XORG
 sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \
-              migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
+              migc.h mipointrst.h mizerarc.h micoord.h \
               mistruct.h mioverlay.h
 endif
 
diff --git a/mi/mifillarc.c b/mi/mifillarc.c
index 08484d7..9a5e785 100644
--- a/mi/mifillarc.c
+++ b/mi/mifillarc.c
@@ -51,7 +51,7 @@ Author:  Bob Scheifler, MIT X Consortium
 #define Dsin(d)	sin((double)d*(M_PI/11520.0))
 #define Dcos(d)	cos((double)d*(M_PI/11520.0))
 
-void
+static void
 miFillArcSetup(xArc * arc, miFillArcRec * info)
 {
     info->y = arc->height >> 1;
@@ -277,7 +277,7 @@ miGetPieEdge(xArc * arc, int angle, miSliceEdgePtr edge, Bool top, Bool left)
     miGetArcEdge(arc, edge, k, top, left);
 }
 
-void
+static void
 miFillArcSliceSetup(xArc * arc, miArcSliceRec * slice, GCPtr pGC)
 {
     int angle1, angle2;
diff --git a/mi/mifillarc.h b/mi/mifillarc.h
index 1478d18..61ab253 100644
--- a/mi/mifillarc.h
+++ b/mi/mifillarc.h
@@ -175,13 +175,4 @@ typedef struct _miArcSlice {
 #define miFillInArcLower(slw) (((iny + dy) != 0) && \
 			       ((slw > 1) || (ine != inxk)))
 
-extern _X_EXPORT void miFillArcSetup(xArc * /*arc */ ,
-                                     miFillArcRec *     /*info */
-    );
-
-extern _X_EXPORT void miFillArcSliceSetup(xArc * /*arc */ ,
-                                          miArcSliceRec * /*slice */ ,
-                                          GCPtr /*pGC */
-    );
-
 #endif                          /* __MIFILLARC_H__ */
commit ce8fff5cd681523088c14b97ce4fb6e4fb658321
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 23 12:06:03 2014 -0400

    mi: Unexport subpixel polygon implementation details
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/Makefile.am b/mi/Makefile.am
index b93a8f9..b243029 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libmi.la
 if XORG
 sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \
               migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
-              mistruct.h mifpoly.h mioverlay.h
+              mistruct.h mioverlay.h
 endif
 
 AM_CFLAGS = $(DIX_CFLAGS)
diff --git a/mi/mifpoly.h b/mi/mifpoly.h
index f853fb4..4b27d1c 100644
--- a/mi/mifpoly.h
+++ b/mi/mifpoly.h
@@ -89,14 +89,13 @@ typedef struct _SppArc {
 
 /* mifpolycon.c */
 
-extern _X_EXPORT void miFillSppPoly(DrawablePtr /*dst */ ,
-                                    GCPtr /*pgc */ ,
-                                    int /*count */ ,
-                                    SppPointPtr /*ptsIn */ ,
-                                    int /*xTrans */ ,
-                                    int /*yTrans */ ,
-                                    double /*xFtrans */ ,
-                                    double      /*yFtrans */
-    );
+extern void miFillSppPoly(DrawablePtr /*dst */ ,
+                          GCPtr /*pgc */ ,
+                          int /*count */ ,
+                          SppPointPtr /*ptsIn */ ,
+                          int /*xTrans */ ,
+                          int /*yTrans */ ,
+                          double /*xFtrans */ ,
+                          double      /*yFtrans */);
 
 #endif                          /* __MIFPOLY_H__ */
commit a085ba82bde375b5c884a40b410b563815c58a9e
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 23 11:55:05 2014 -0400

    mi: Unexport span group implementation details
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/Makefile.am b/mi/Makefile.am
index 526f4bb..b93a8f9 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libmi.la
 if XORG
 sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \
               migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
-              mispans.h mistruct.h mifpoly.h mioverlay.h
+              mistruct.h mifpoly.h mioverlay.h
 endif
 
 AM_CFLAGS = $(DIX_CFLAGS)
diff --git a/mi/mispans.h b/mi/mispans.h
index f3148ff..7c3fcef 100644
--- a/mi/mispans.h
+++ b/mi/mispans.h
@@ -61,24 +61,20 @@ typedef struct {
 } SpanGroup;
 
 /* Initialize SpanGroup.  MUST BE DONE before use. */
-extern _X_EXPORT void miInitSpanGroup(SpanGroup *       /*spanGroup */
-    );
+extern void miInitSpanGroup(SpanGroup *       /*spanGroup */);
 
 /* Add a Spans to a SpanGroup. The spans MUST BE in y-sorted order */
-extern _X_EXPORT void miAppendSpans(SpanGroup * /*spanGroup */ ,
-                                    SpanGroup * /*otherGroup */ ,
-                                    Spans *     /*spans */
-    );
+extern void miAppendSpans(SpanGroup * /*spanGroup */ ,
+                          SpanGroup * /*otherGroup */ ,
+                          Spans *     /*spans */);
 
 /* Paint a span group, insuring that each pixel is painted at most once */
-extern _X_EXPORT void miFillUniqueSpanGroup(DrawablePtr /*pDraw */ ,
-                                            GCPtr /*pGC */ ,
-                                            SpanGroup * /*spanGroup */
-    );
+extern void miFillUniqueSpanGroup(DrawablePtr /*pDraw */ ,
+                                  GCPtr /*pGC */ ,
+                                  SpanGroup * /*spanGroup */);
 
 /* Free up data in a span group.  MUST BE DONE or you'll suffer memory leaks */
-extern _X_EXPORT void miFreeSpanGroup(SpanGroup *       /*spanGroup */
-    );
+extern void miFreeSpanGroup(SpanGroup *       /*spanGroup */);
 
 /* Rops which must use span groups */
 #define miSpansCarefulRop(rop)	(((rop) & 0xc) == 0x8 || ((rop) & 0x3) == 0x2)
commit c15c886ee70f9144bc4603b918310f229312aadc
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 23 11:50:07 2014 -0400

    mi: Unexport polygon edge table implementation details
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/mi/mipoly.h b/mi/mipoly.h
index e37fb48..02fcfc8 100644
--- a/mi/mipoly.h
+++ b/mi/mipoly.h
@@ -174,20 +174,17 @@ typedef struct _ScanLineListBlock {
 
 /* mipolyutil.c */
 
-extern _X_EXPORT Bool miCreateETandAET(int /*count */ ,
-                                       DDXPointPtr /*pts */ ,
-                                       EdgeTable * /*ET*/,
-                                       EdgeTableEntry * /*AET*/,
-                                       EdgeTableEntry * /*pETEs */ ,
-                                       ScanLineListBlock *      /*pSLLBlock */
-    );
+extern Bool miCreateETandAET(int /*count */ ,
+                             DDXPointPtr /*pts */ ,
+                             EdgeTable * /*ET*/,
+                             EdgeTableEntry * /*AET*/,
+                             EdgeTableEntry * /*pETEs */ ,
+                             ScanLineListBlock *      /*pSLLBlock */);
 
-extern _X_EXPORT void miloadAET(EdgeTableEntry * /*AET*/, EdgeTableEntry *      /*ETEs */
-    );
+extern void miloadAET(EdgeTableEntry * /*AET*/, EdgeTableEntry * /*ETEs */);
 
-extern _X_EXPORT void micomputeWAET(EdgeTableEntry * /*AET*/);
+extern void micomputeWAET(EdgeTableEntry * /*AET*/);
 
-extern _X_EXPORT int miInsertionSort(EdgeTableEntry * /*AET*/);
+extern int miInsertionSort(EdgeTableEntry * /*AET*/);
 
-extern _X_EXPORT void miFreeStorage(ScanLineListBlock * /*pSLLBlock */
-    );
+extern void miFreeStorage(ScanLineListBlock * /*pSLLBlock */);
commit 9bdc9b0113915de3d536b2b3f025915379c2126f
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri May 23 11:21:28 2014 -0400

    mi: Unexport wide line details
    
    XAA wanted these, once upon a time, but that's gone now.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index d9a4478..c2a1942 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -217,7 +217,6 @@ cat > sdksyms.c << EOF
 #include "micoord.h"
 #include "mifillarc.h"
 #include "mispans.h"
-#include "miwideline.h"
 #include "mistruct.h"
 #include "mifpoly.h"
 #include "mioverlay.h"
diff --git a/mi/Makefile.am b/mi/Makefile.am
index 0cef779..526f4bb 100644
--- a/mi/Makefile.am
+++ b/mi/Makefile.am
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libmi.la
 if XORG
 sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \
               migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
-              mispans.h miwideline.h mistruct.h mifpoly.h mioverlay.h
+              mispans.h mistruct.h mifpoly.h mioverlay.h
 endif
 
 AM_CFLAGS = $(DIX_CFLAGS)
diff --git a/mi/miwideline.c b/mi/miwideline.c
index 29ba12c..295a05a 100644
--- a/mi/miwideline.c
+++ b/mi/miwideline.c
@@ -273,7 +273,7 @@ miFillRectPolyHelper(DrawablePtr pDrawable,
     }
 }
 
-/* static */ int
+static int
 miPolyBuildEdge(double x0, double y0, double k, /* x0 * dy - y0 * dx */
                 int dx, int dy, int xi, int yi, int left, PolyEdgePtr edge)
 {
@@ -325,7 +325,7 @@ miPolyBuildEdge(double x0, double y0, double k, /* x0 * dy - y0 * dx */
 
 #define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr)))
 
-/* static */ int
+static int
 miPolyBuildPoly(PolyVertexPtr vertices,
                 PolySlopePtr slopes,
                 int count,
@@ -865,7 +865,7 @@ miRoundJoinFace(LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge)
     return y;
 }
 
-void
+static void
 miRoundJoinClip(LineFacePtr pLeft, LineFacePtr pRight,
                 PolyEdgePtr edge1, PolyEdgePtr edge2,
                 int *y1, int *y2, Bool *left1, Bool *left2)
@@ -886,7 +886,7 @@ miRoundJoinClip(LineFacePtr pLeft, LineFacePtr pRight,
     *y2 = miRoundJoinFace(pRight, edge2, left2);
 }
 
-int
+static int
 miRoundCapClip(LineFacePtr face, Bool isInt, PolyEdgePtr edge, Bool *leftEdge)
 {
     int y;
diff --git a/mi/miwideline.h b/mi/miwideline.h
index 1105411..a9f2740 100644
--- a/mi/miwideline.h
+++ b/mi/miwideline.h
@@ -92,28 +92,3 @@ typedef struct _LineFace {
 	ValidateGC (pDrawable, pGC); \
     } \
 }
-
-extern _X_EXPORT void miRoundJoinClip(LineFacePtr /*pLeft */ ,
-                                      LineFacePtr /*pRight */ ,
-                                      PolyEdgePtr /*edge1 */ ,
-                                      PolyEdgePtr /*edge2 */ ,
-                                      int * /*y1 */ ,
-                                      int * /*y2 */ ,
-                                      Bool * /*left1 */ ,
-                                      Bool *    /*left2 */
-    );
-
-extern _X_EXPORT int miRoundCapClip(LineFacePtr /*face */ ,
-                                    Bool /*isInt */ ,
-                                    PolyEdgePtr /*edge */ ,
-                                    Bool *      /*leftEdge */
-    );
-
-extern _X_EXPORT int miPolyBuildEdge(double x0, double y0, double k, int dx,
-                                     int dy, int xi, int yi, int left,
-                                     PolyEdgePtr edge);
-extern _X_EXPORT int miPolyBuildPoly(PolyVertexPtr vertices,
-                                     PolySlopePtr slopes, int count, int xi,
-                                     int yi, PolyEdgePtr left,
-                                     PolyEdgePtr right, int *pnleft,
-                                     int *pnright, int *h);


More information about the xorg-commit mailing list