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: 8465ee788f
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1502>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-04-18 20:14:14 +02:00
parent c90543968b
commit e89ed59c94
2 changed files with 0 additions and 199 deletions

11
mi/mi.h
View File

@ -80,17 +80,6 @@ extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
/* mibitblt.c */ /* 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 */ , extern _X_EXPORT void miGetImage(DrawablePtr /*pDraw */ ,
int /*sx */ , int /*sx */ ,
int /*sy */ , int /*sy */ ,

View File

@ -66,194 +66,6 @@ SOFTWARE.
#define ffs __builtin_ffs #define ffs __builtin_ffs
#endif #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 /* MIGETPLANE -- gets a bitmap representing one plane of pDraw
* A helper used for CopyPlane and XY format GetImage * A helper used for CopyPlane and XY format GetImage
* No clever strategy here, we grab a scanline at a time, pull out the * No clever strategy here, we grab a scanline at a time, pull out the