mi: drop unused miGetImage()
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:
parent
e89ed59c94
commit
c0589e228c
10
mi/mi.h
10
mi/mi.h
|
@ -80,16 +80,6 @@ extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
|
||||||
|
|
||||||
/* mibitblt.c */
|
/* mibitblt.c */
|
||||||
|
|
||||||
extern _X_EXPORT void miGetImage(DrawablePtr /*pDraw */ ,
|
|
||||||
int /*sx */ ,
|
|
||||||
int /*sy */ ,
|
|
||||||
int /*w */ ,
|
|
||||||
int /*h */ ,
|
|
||||||
unsigned int /*format */ ,
|
|
||||||
unsigned long /*planeMask */ ,
|
|
||||||
char * /*pdstLine */
|
|
||||||
);
|
|
||||||
|
|
||||||
extern _X_EXPORT void miPutImage(DrawablePtr /*pDraw */ ,
|
extern _X_EXPORT void miPutImage(DrawablePtr /*pDraw */ ,
|
||||||
GCPtr /*pGC */ ,
|
GCPtr /*pGC */ ,
|
||||||
int /*depth */ ,
|
int /*depth */ ,
|
||||||
|
|
191
mi/mibitblt.c
191
mi/mibitblt.c
|
@ -66,111 +66,6 @@ SOFTWARE.
|
||||||
#define ffs __builtin_ffs
|
#define ffs __builtin_ffs
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 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
|
|
||||||
* bits and then stuff them in a 1 bit deep map.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* This should be replaced with something more general. mi shouldn't have to
|
|
||||||
* care about such things as scanline padding et alia.
|
|
||||||
*/
|
|
||||||
_X_COLD static MiBits *
|
|
||||||
miGetPlane(DrawablePtr pDraw, int planeNum, /* number of the bitPlane */
|
|
||||||
int sx, int sy, int w, int h, MiBits * result)
|
|
||||||
{
|
|
||||||
int i, j, k, width, bitsPerPixel, widthInBytes;
|
|
||||||
DDXPointRec pt = { 0, 0 };
|
|
||||||
MiBits pixel;
|
|
||||||
MiBits bit;
|
|
||||||
unsigned char *pCharsOut = NULL;
|
|
||||||
|
|
||||||
#if BITMAP_SCANLINE_UNIT == 8
|
|
||||||
#define OUT_TYPE unsigned char
|
|
||||||
#endif
|
|
||||||
#if BITMAP_SCANLINE_UNIT == 16
|
|
||||||
#define OUT_TYPE CARD16
|
|
||||||
#endif
|
|
||||||
#if BITMAP_SCANLINE_UNIT == 32
|
|
||||||
#define OUT_TYPE CARD32
|
|
||||||
#endif
|
|
||||||
#if BITMAP_SCANLINE_UNIT == 64
|
|
||||||
#define OUT_TYPE CARD64
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OUT_TYPE *pOut;
|
|
||||||
int delta = 0;
|
|
||||||
|
|
||||||
sx += pDraw->x;
|
|
||||||
sy += pDraw->y;
|
|
||||||
widthInBytes = BitmapBytePad(w);
|
|
||||||
if (!result)
|
|
||||||
result = calloc(h, widthInBytes);
|
|
||||||
if (!result)
|
|
||||||
return NULL;
|
|
||||||
bitsPerPixel = pDraw->bitsPerPixel;
|
|
||||||
pOut = (OUT_TYPE *) result;
|
|
||||||
if (bitsPerPixel == 1) {
|
|
||||||
pCharsOut = (unsigned char *) result;
|
|
||||||
width = w;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
delta = (widthInBytes / (BITMAP_SCANLINE_UNIT / 8)) -
|
|
||||||
(w / BITMAP_SCANLINE_UNIT);
|
|
||||||
width = 1;
|
|
||||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
|
||||||
planeNum += (32 - bitsPerPixel);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
pt.y = sy;
|
|
||||||
for (i = h; --i >= 0; pt.y++) {
|
|
||||||
pt.x = sx;
|
|
||||||
if (bitsPerPixel == 1) {
|
|
||||||
(*pDraw->pScreen->GetSpans) (pDraw, width, &pt, &width, 1,
|
|
||||||
(char *) pCharsOut);
|
|
||||||
pCharsOut += widthInBytes;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
k = 0;
|
|
||||||
for (j = w; --j >= 0; pt.x++) {
|
|
||||||
/* Fetch the next pixel */
|
|
||||||
(*pDraw->pScreen->GetSpans) (pDraw, width, &pt, &width, 1,
|
|
||||||
(char *) &pixel);
|
|
||||||
/*
|
|
||||||
* Now get the bit and insert into a bitmap in XY format.
|
|
||||||
*/
|
|
||||||
bit = (pixel >> planeNum) & 1;
|
|
||||||
#if 0
|
|
||||||
/* XXX assuming bit order == byte order */
|
|
||||||
#if BITMAP_BIT_ORDER == LSBFirst
|
|
||||||
bit <<= k;
|
|
||||||
#else
|
|
||||||
bit <<= ((BITMAP_SCANLINE_UNIT - 1) - k);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
/* XXX assuming byte order == LSBFirst */
|
|
||||||
if (screenInfo.bitmapBitOrder == LSBFirst)
|
|
||||||
bit <<= k;
|
|
||||||
else
|
|
||||||
bit <<= ((screenInfo.bitmapScanlineUnit - 1) -
|
|
||||||
(k % screenInfo.bitmapScanlineUnit)) +
|
|
||||||
((k / screenInfo.bitmapScanlineUnit) *
|
|
||||||
screenInfo.bitmapScanlineUnit);
|
|
||||||
#endif
|
|
||||||
*pOut |= (OUT_TYPE) bit;
|
|
||||||
k++;
|
|
||||||
if (k == BITMAP_SCANLINE_UNIT) {
|
|
||||||
pOut++;
|
|
||||||
k = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pOut += delta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MIOPQSTIPDRAWABLE -- use pbits as an opaque stipple for pDraw.
|
/* MIOPQSTIPDRAWABLE -- use pbits as an opaque stipple for pDraw.
|
||||||
* Drawing through the clip mask we SetSpans() the bits into a
|
* Drawing through the clip mask we SetSpans() the bits into a
|
||||||
* bitmap and stipple those bits onto the destination drawable by doing a
|
* bitmap and stipple those bits onto the destination drawable by doing a
|
||||||
|
@ -317,92 +212,6 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MIGETIMAGE -- public entry for the GetImage Request
|
|
||||||
* We're getting the image into a memory buffer. While we have to use GetSpans
|
|
||||||
* to read a line from the device (since we don't know what that looks like),
|
|
||||||
* we can just write into the destination buffer
|
|
||||||
*
|
|
||||||
* two different strategies are used, depending on whether we're getting the
|
|
||||||
* image in Z format or XY format
|
|
||||||
* Z format:
|
|
||||||
* Line at a time, GetSpans a line into the destination buffer, then if the
|
|
||||||
* planemask is not all ones, we do a SetSpans into a temporary buffer (to get
|
|
||||||
* bits turned off) and then another GetSpans to get stuff back (because
|
|
||||||
* pixmaps are opaque, and we are passed in the memory to write into). This is
|
|
||||||
* pretty ugly and slow but works. Life is hard.
|
|
||||||
* XY format:
|
|
||||||
* get the single plane specified in planemask
|
|
||||||
*/
|
|
||||||
_X_COLD void
|
|
||||||
miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h,
|
|
||||||
unsigned int format, unsigned long planeMask, char *pDst)
|
|
||||||
{
|
|
||||||
unsigned char depth;
|
|
||||||
int i, linelength, width, srcx, srcy;
|
|
||||||
DDXPointRec pt = { 0, 0 };
|
|
||||||
PixmapPtr pPixmap = NULL;
|
|
||||||
GCPtr pGC = NULL;
|
|
||||||
|
|
||||||
depth = pDraw->depth;
|
|
||||||
if (format == ZPixmap) {
|
|
||||||
if ((((1LL << depth) - 1) & planeMask) != (1LL << depth) - 1) {
|
|
||||||
ChangeGCVal gcv;
|
|
||||||
xPoint xpt;
|
|
||||||
|
|
||||||
pGC = GetScratchGC(depth, pDraw->pScreen);
|
|
||||||
if (!pGC)
|
|
||||||
return;
|
|
||||||
pPixmap = (*pDraw->pScreen->CreatePixmap)
|
|
||||||
(pDraw->pScreen, w, 1, depth, CREATE_PIXMAP_USAGE_SCRATCH);
|
|
||||||
if (!pPixmap) {
|
|
||||||
FreeScratchGC(pGC);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Clear the pixmap before doing anything else
|
|
||||||
*/
|
|
||||||
ValidateGC((DrawablePtr) pPixmap, pGC);
|
|
||||||
xpt.x = xpt.y = 0;
|
|
||||||
width = w;
|
|
||||||
(*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &xpt, &width,
|
|
||||||
TRUE);
|
|
||||||
|
|
||||||
/* alu is already GXCopy */
|
|
||||||
gcv.val = (XID) planeMask;
|
|
||||||
ChangeGC(NullClient, pGC, GCPlaneMask, &gcv);
|
|
||||||
ValidateGC((DrawablePtr) pPixmap, pGC);
|
|
||||||
}
|
|
||||||
|
|
||||||
linelength = PixmapBytePad(w, depth);
|
|
||||||
srcx = sx + pDraw->x;
|
|
||||||
srcy = sy + pDraw->y;
|
|
||||||
for (i = 0; i < h; i++) {
|
|
||||||
pt.x = srcx;
|
|
||||||
pt.y = srcy + i;
|
|
||||||
width = w;
|
|
||||||
(*pDraw->pScreen->GetSpans) (pDraw, w, &pt, &width, 1, pDst);
|
|
||||||
if (pPixmap) {
|
|
||||||
pt.x = 0;
|
|
||||||
pt.y = 0;
|
|
||||||
width = w;
|
|
||||||
(*pGC->ops->SetSpans) ((DrawablePtr) pPixmap, pGC, pDst,
|
|
||||||
&pt, &width, 1, TRUE);
|
|
||||||
(*pDraw->pScreen->GetSpans) ((DrawablePtr) pPixmap, w, &pt,
|
|
||||||
&width, 1, pDst);
|
|
||||||
}
|
|
||||||
pDst += linelength;
|
|
||||||
}
|
|
||||||
if (pPixmap) {
|
|
||||||
(*pGC->pScreen->DestroyPixmap) (pPixmap);
|
|
||||||
FreeScratchGC(pGC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
(void) miGetPlane(pDraw, ffs(planeMask) - 1, sx, sy, w, h,
|
|
||||||
(MiBits *) pDst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MIPUTIMAGE -- public entry for the PutImage request
|
/* MIPUTIMAGE -- public entry for the PutImage request
|
||||||
* Here we benefit from knowing the format of the bits pointed to by pImage,
|
* Here we benefit from knowing the format of the bits pointed to by pImage,
|
||||||
* even if we don't know how pDraw represents them.
|
* even if we don't know how pDraw represents them.
|
||||||
|
|
Loading…
Reference in New Issue