[PATCH 4/7] mi: Remove miCopyArea

Adam Jackson ajax at redhat.com
Wed Oct 8 05:17:16 PDT 2014


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 mi/mi.h       |  11 ----
 mi/mibitblt.c | 187 ----------------------------------------------------------
 2 files changed, 198 deletions(-)

diff --git a/mi/mi.h b/mi/mi.h
index 1d9f76a..884af9a 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -80,17 +80,6 @@ extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
 
 /* mibitblt.c */
 
-extern _X_EXPORT RegionPtr miCopyArea(DrawablePtr /*pSrcDrawable */ ,
-                                      DrawablePtr /*pDstDrawable */ ,
-                                      GCPtr /*pGC */ ,
-                                      int /*xIn */ ,
-                                      int /*yIn */ ,
-                                      int /*widthSrc */ ,
-                                      int /*heightSrc */ ,
-                                      int /*xOut */ ,
-                                      int       /*yOut */
-    );
-
 extern _X_EXPORT RegionPtr miCopyPlane(DrawablePtr /*pSrcDrawable */ ,
                                        DrawablePtr /*pDstDrawable */ ,
                                        GCPtr /*pGC */ ,
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index c2e4d56..f6c5998 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -66,193 +66,6 @@ SOFTWARE.
 extern int ffs(int);
 #endif
 
-/* MICOPYAREA -- public entry for the CopyArea request 
- * For each rectangle in the source region
- *     get the pixels with GetSpans
- *     set them in the destination with SetSpans
- * We let SetSpans worry about clipping to the destination.
- */
-RegionPtr
-miCopyArea(DrawablePtr pSrcDrawable,
-           DrawablePtr pDstDrawable,
-           GCPtr pGC,
-           int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut)
-{
-    DDXPointPtr ppt, pptFirst;
-    unsigned int *pwidthFirst, *pwidth, *pbits;
-    BoxRec srcBox, *prect;
-
-    /* may be a new region, or just a copy */
-    RegionPtr prgnSrcClip;
-
-    /* non-0 if we've created a src clip */
-    RegionPtr prgnExposed;
-    int realSrcClip = 0;
-    int srcx, srcy, dstx, dsty, i, j, y, width, height, xMin, xMax, yMin, yMax;
-    unsigned int *ordering;
-    int numRects;
-    BoxPtr boxes;
-
-    srcx = xIn + pSrcDrawable->x;
-    srcy = yIn + pSrcDrawable->y;
-
-    /* If the destination isn't realized, this is easy */
-    if (pDstDrawable->type == DRAWABLE_WINDOW &&
-        !((WindowPtr) pDstDrawable)->realized)
-        return NULL;
-
-    /* clip the source */
-    if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
-        BoxRec box;
-
-        box.x1 = pSrcDrawable->x;
-        box.y1 = pSrcDrawable->y;
-        box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
-        box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
-
-        prgnSrcClip = RegionCreate(&box, 1);
-        realSrcClip = 1;
-    }
-    else {
-        if (pGC->subWindowMode == IncludeInferiors) {
-            prgnSrcClip = NotClippedByChildren((WindowPtr) pSrcDrawable);
-            realSrcClip = 1;
-        }
-        else
-            prgnSrcClip = &((WindowPtr) pSrcDrawable)->clipList;
-    }
-
-    /* If the src drawable is a window, we need to translate the srcBox so
-     * that we can compare it with the window's clip region later on. */
-    srcBox.x1 = srcx;
-    srcBox.y1 = srcy;
-    srcBox.x2 = srcx + widthSrc;
-    srcBox.y2 = srcy + heightSrc;
-
-    dstx = xOut;
-    dsty = yOut;
-    if (pGC->miTranslate) {
-        dstx += pDstDrawable->x;
-        dsty += pDstDrawable->y;
-    }
-
-    pptFirst = ppt = malloc(heightSrc * sizeof(DDXPointRec));
-    pwidthFirst = pwidth = malloc(heightSrc * sizeof(unsigned int));
-    numRects = RegionNumRects(prgnSrcClip);
-    boxes = RegionRects(prgnSrcClip);
-    ordering = malloc(numRects * sizeof(unsigned int));
-    if (!pptFirst || !pwidthFirst || !ordering) {
-        free(ordering);
-        free(pwidthFirst);
-        free(pptFirst);
-        return NULL;
-    }
-
-    /* If not the same drawable then order of move doesn't matter.
-       Following assumes that boxes are sorted from top
-       to bottom and left to right.
-     */
-    if ((pSrcDrawable != pDstDrawable) &&
-        ((pGC->subWindowMode != IncludeInferiors) ||
-         (pSrcDrawable->type == DRAWABLE_PIXMAP) ||
-         (pDstDrawable->type == DRAWABLE_PIXMAP)))
-        for (i = 0; i < numRects; i++)
-            ordering[i] = i;
-    else {                      /* within same drawable, must sequence moves carefully! */
-        if (dsty <= srcBox.y1) {        /* Scroll up or stationary vertical.
-                                           Vertical order OK */
-            if (dstx <= srcBox.x1)      /* Scroll left or stationary horizontal.
-                                           Horizontal order OK as well */
-                for (i = 0; i < numRects; i++)
-                    ordering[i] = i;
-            else {              /* scroll right. must reverse horizontal banding of rects. */
-                for (i = 0, j = 1, xMax = 0; i < numRects; j = i + 1, xMax = i) {
-                    /* find extent of current horizontal band */
-                    y = boxes[i].y1;    /* band has this y coordinate */
-                    while ((j < numRects) && (boxes[j].y1 == y))
-                        j++;
-                    /* reverse the horizontal band in the output ordering */
-                    for (j--; j >= xMax; j--, i++)
-                        ordering[i] = j;
-                }
-            }
-        }
-        else {                  /* Scroll down. Must reverse vertical banding. */
-            if (dstx < srcBox.x1) {     /* Scroll left. Horizontal order OK. */
-                for (i = numRects - 1, j = i - 1, yMin = i, yMax = 0;
-                     i >= 0; j = i - 1, yMin = i) {
-                    /* find extent of current horizontal band */
-                    y = boxes[i].y1;    /* band has this y coordinate */
-                    while ((j >= 0) && (boxes[j].y1 == y))
-                        j--;
-                    /* reverse the horizontal band in the output ordering */
-                    for (j++; j <= yMin; j++, i--, yMax++)
-                        ordering[yMax] = j;
-                }
-            }
-            else                /* Scroll right or horizontal stationary.
-                                   Reverse horizontal order as well (if stationary, horizontal
-                                   order can be swapped without penalty and this is faster
-                                   to compute). */
-                for (i = 0, j = numRects - 1; i < numRects; i++, j--)
-                    ordering[i] = j;
-        }
-    }
-
-    for (i = 0; i < numRects; i++) {
-        prect = &boxes[ordering[i]];
-        xMin = max(prect->x1, srcBox.x1);
-        xMax = min(prect->x2, srcBox.x2);
-        yMin = max(prect->y1, srcBox.y1);
-        yMax = min(prect->y2, srcBox.y2);
-        /* is there anything visible here? */
-        if (xMax <= xMin || yMax <= yMin)
-            continue;
-
-        ppt = pptFirst;
-        pwidth = pwidthFirst;
-        y = yMin;
-        height = yMax - yMin;
-        width = xMax - xMin;
-
-        for (j = 0; j < height; j++) {
-            /* We must untranslate before calling GetSpans */
-            ppt->x = xMin;
-            ppt++->y = y++;
-            *pwidth++ = width;
-        }
-        pbits = malloc(height * PixmapBytePad(width, pSrcDrawable->depth));
-        if (pbits) {
-            (*pSrcDrawable->pScreen->GetSpans) (pSrcDrawable, width, pptFirst,
-                                                (int *) pwidthFirst, height,
-                                                (char *) pbits);
-            ppt = pptFirst;
-            pwidth = pwidthFirst;
-            xMin -= (srcx - dstx);
-            y = yMin - (srcy - dsty);
-            for (j = 0; j < height; j++) {
-                ppt->x = xMin;
-                ppt++->y = y++;
-                *pwidth++ = width;
-            }
-
-            (*pGC->ops->SetSpans) (pDstDrawable, pGC, (char *) pbits, pptFirst,
-                                   (int *) pwidthFirst, height, TRUE);
-            free(pbits);
-        }
-    }
-    prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
-                                    widthSrc, heightSrc, xOut, yOut,
-                                    (unsigned long) 0);
-    if (realSrcClip)
-        RegionDestroy(prgnSrcClip);
-
-    free(ordering);
-    free(pwidthFirst);
-    free(pptFirst);
-    return prgnExposed;
-}
-
 /* MIGETPLANE -- gets a bitmap representing one plane of pDraw
  * A helper used for CopyPlane and XY format GetImage 
  * No clever strategy here, we grab a scanline at a time, pull out the
-- 
1.9.3



More information about the xorg-devel mailing list