From e89ed59c9406e838ba05555c96080ad3d638b2c1 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 18 Apr 2024 20:14:14 +0200 Subject: [PATCH] mi: drop unused miCopyArea() With removal of Xwin's NATIVEGDI (back a decade ago), the last caller is gone, and it also doesn't seem to be called by any driver. Fixes: 8465ee788fd541fa37681aa0a44103c7f944d437 Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- mi/mi.h | 11 --- mi/mibitblt.c | 188 -------------------------------------------------- 2 files changed, 199 deletions(-) diff --git a/mi/mi.h b/mi/mi.h index c297e3785..1e0d5a603 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 void miGetImage(DrawablePtr /*pDraw */ , int /*sx */ , int /*sy */ , diff --git a/mi/mibitblt.c b/mi/mibitblt.c index 0757cb4f0..dd2cfcb8b 100644 --- a/mi/mibitblt.c +++ b/mi/mibitblt.c @@ -66,194 +66,6 @@ SOFTWARE. #define ffs __builtin_ffs #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. - */ -_X_COLD 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 = xallocarray(heightSrc, sizeof(DDXPointRec)); - pwidthFirst = pwidth = xallocarray(heightSrc, sizeof(unsigned int)); - numRects = RegionNumRects(prgnSrcClip); - boxes = RegionRects(prgnSrcClip); - ordering = xallocarray(numRects, sizeof(unsigned int)); - if (!pptFirst || !pwidthFirst || !ordering) { - free(ordering); - free(pwidthFirst); - free(pptFirst); - if (realSrcClip) - RegionDestroy(prgnSrcClip); - 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 = xallocarray(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); - 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