[PATCH 5/7] mi: Remove miCopyPlane
Adam Jackson
ajax at redhat.com
Wed Oct 8 05:17:17 PDT 2014
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
mi/mi.h | 12 ----
mi/mibitblt.c | 225 ----------------------------------------------------------
2 files changed, 237 deletions(-)
diff --git a/mi/mi.h b/mi/mi.h
index 884af9a..48bc272 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -80,18 +80,6 @@ extern _X_EXPORT void miPolyArc(DrawablePtr /*pDraw */ ,
/* mibitblt.c */
-extern _X_EXPORT RegionPtr miCopyPlane(DrawablePtr /*pSrcDrawable */ ,
- DrawablePtr /*pDstDrawable */ ,
- GCPtr /*pGC */ ,
- int /*srcx */ ,
- int /*srcy */ ,
- int /*width */ ,
- int /*height */ ,
- int /*dstx */ ,
- int /*dsty */ ,
- unsigned long /*bitPlane */
- );
-
extern _X_EXPORT void miGetImage(DrawablePtr /*pDraw */ ,
int /*sx */ ,
int /*sy */ ,
diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index f6c5998..bbba14b 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -172,231 +172,6 @@ miGetPlane(DrawablePtr pDraw, int planeNum, /* number of the bitPlane */
}
-/* MIOPQSTIPDRAWABLE -- use pbits as an opaque stipple for pDraw.
- * Drawing through the clip mask we SetSpans() the bits into a
- * bitmap and stipple those bits onto the destination drawable by doing a
- * PolyFillRect over the whole drawable,
- * then we invert the bitmap by copying it onto itself with an alu of
- * GXinvert, invert the foreground/background colors of the gc, and draw
- * the background bits.
- * Note how the clipped out bits of the bitmap are always the background
- * color so that the stipple never causes FillRect to draw them.
- */
-static void
-miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
- MiBits * pbits, int srcx, int w, int h, int dstx, int dsty)
-{
- int oldfill, i;
- unsigned long oldfg;
- int *pwidth, *pwidthFirst;
- ChangeGCVal gcv[6];
- PixmapPtr pStipple, pPixmap;
- DDXPointRec oldOrg;
- GCPtr pGCT;
- DDXPointPtr ppt, pptFirst;
- xRectangle rect;
- RegionPtr prgnSrcClip;
-
- pPixmap = (*pDraw->pScreen->CreatePixmap)
- (pDraw->pScreen, w + srcx, h, 1, CREATE_PIXMAP_USAGE_SCRATCH);
- if (!pPixmap)
- return;
-
- /* Put the image into a 1 bit deep pixmap */
- pGCT = GetScratchGC(1, pDraw->pScreen);
- if (!pGCT) {
- (*pDraw->pScreen->DestroyPixmap) (pPixmap);
- return;
- }
- /* First set the whole pixmap to 0 */
- gcv[0].val = 0;
- ChangeGC(NullClient, pGCT, GCBackground, gcv);
- ValidateGC((DrawablePtr) pPixmap, pGCT);
- miClearDrawable((DrawablePtr) pPixmap, pGCT);
- ppt = pptFirst = malloc(h * sizeof(DDXPointRec));
- pwidth = pwidthFirst = malloc(h * sizeof(int));
- if (!pptFirst || !pwidthFirst) {
- free(pwidthFirst);
- free(pptFirst);
- FreeScratchGC(pGCT);
- return;
- }
-
- /* we need a temporary region because ChangeClip must be assumed
- to destroy what it's sent. note that this means we don't
- have to free prgnSrcClip ourselves.
- */
- prgnSrcClip = RegionCreate(NULL, 0);
- RegionCopy(prgnSrcClip, prgnSrc);
- RegionTranslate(prgnSrcClip, srcx, 0);
- (*pGCT->funcs->ChangeClip) (pGCT, CT_REGION, prgnSrcClip, 0);
- ValidateGC((DrawablePtr) pPixmap, pGCT);
-
- /* Since we know pDraw is always a pixmap, we never need to think
- * about translation here */
- for (i = 0; i < h; i++) {
- ppt->x = 0;
- ppt++->y = i;
- *pwidth++ = w + srcx;
- }
-
- (*pGCT->ops->SetSpans) ((DrawablePtr) pPixmap, pGCT, (char *) pbits,
- pptFirst, pwidthFirst, h, TRUE);
- free(pwidthFirst);
- free(pptFirst);
-
- /* Save current values from the client GC */
- oldfill = pGC->fillStyle;
- pStipple = pGC->stipple;
- if (pStipple)
- pStipple->refcnt++;
- oldOrg = pGC->patOrg;
-
- /* Set a new stipple in the drawable */
- gcv[0].val = FillStippled;
- gcv[1].ptr = pPixmap;
- gcv[2].val = dstx - srcx;
- gcv[3].val = dsty;
-
- ChangeGC(NullClient, pGC,
- GCFillStyle | GCStipple | GCTileStipXOrigin | GCTileStipYOrigin,
- gcv);
- ValidateGC(pDraw, pGC);
-
- /* Fill the drawable with the stipple. This will draw the
- * foreground color whereever 1 bits are set, leaving everything
- * with 0 bits untouched. Note that the part outside the clip
- * region is all 0s. */
- rect.x = dstx;
- rect.y = dsty;
- rect.width = w;
- rect.height = h;
- (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect);
-
- /* Invert the tiling pixmap. This sets 0s for 1s and 1s for 0s, only
- * within the clipping region, the part outside is still all 0s */
- gcv[0].val = GXinvert;
- ChangeGC(NullClient, pGCT, GCFunction, gcv);
- ValidateGC((DrawablePtr) pPixmap, pGCT);
- (*pGCT->ops->CopyArea) ((DrawablePtr) pPixmap, (DrawablePtr) pPixmap,
- pGCT, 0, 0, w + srcx, h, 0, 0);
-
- /* Swap foreground and background colors on the GC for the drawable.
- * Now when we fill the drawable, we will fill in the "Background"
- * values */
- oldfg = pGC->fgPixel;
- gcv[0].val = pGC->bgPixel;
- gcv[1].val = oldfg;
- gcv[2].ptr = pPixmap;
- ChangeGC(NullClient, pGC, GCForeground | GCBackground | GCStipple, gcv);
- ValidateGC(pDraw, pGC);
- /* PolyFillRect might have bashed the rectangle */
- rect.x = dstx;
- rect.y = dsty;
- rect.width = w;
- rect.height = h;
- (*pGC->ops->PolyFillRect) (pDraw, pGC, 1, &rect);
-
- /* Now put things back */
- if (pStipple)
- pStipple->refcnt--;
- gcv[0].val = oldfg;
- gcv[1].val = pGC->fgPixel;
- gcv[2].val = oldfill;
- gcv[3].ptr = pStipple;
- gcv[4].val = oldOrg.x;
- gcv[5].val = oldOrg.y;
- ChangeGC(NullClient, pGC,
- GCForeground | GCBackground | GCFillStyle | GCStipple |
- GCTileStipXOrigin | GCTileStipYOrigin, gcv);
-
- ValidateGC(pDraw, pGC);
- /* put what we hope is a smaller clip region back in the scratch gc */
- (*pGCT->funcs->ChangeClip) (pGCT, CT_NONE, NULL, 0);
- FreeScratchGC(pGCT);
- (*pDraw->pScreen->DestroyPixmap) (pPixmap);
-
-}
-
-/* MICOPYPLANE -- public entry for the CopyPlane request.
- * strategy:
- * First build up a bitmap out of the bits requested
- * build a source clip
- * Use the bitmap we've built up as a Stipple for the destination
- */
-RegionPtr
-miCopyPlane(DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GCPtr pGC,
- int srcx,
- int srcy,
- int width, int height, int dstx, int dsty, unsigned long bitPlane)
-{
- MiBits *ptile;
- BoxRec box;
- RegionPtr prgnSrc, prgnExposed;
-
- /* incorporate the source clip */
-
- box.x1 = srcx + pSrcDrawable->x;
- box.y1 = srcy + pSrcDrawable->y;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
- /* clip to visible drawable */
- if (box.x1 < pSrcDrawable->x)
- box.x1 = pSrcDrawable->x;
- if (box.y1 < pSrcDrawable->y)
- box.y1 = pSrcDrawable->y;
- if (box.x2 > pSrcDrawable->x + (int) pSrcDrawable->width)
- box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
- if (box.y2 > pSrcDrawable->y + (int) pSrcDrawable->height)
- box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- if (box.x1 > box.x2)
- box.x2 = box.x1;
- if (box.y1 > box.y2)
- box.y2 = box.y1;
- prgnSrc = RegionCreate(&box, 1);
-
- if (pSrcDrawable->type != DRAWABLE_PIXMAP) {
- /* clip to visible drawable */
-
- if (pGC->subWindowMode == IncludeInferiors) {
- RegionPtr clipList = NotClippedByChildren((WindowPtr) pSrcDrawable);
-
- RegionIntersect(prgnSrc, prgnSrc, clipList);
- RegionDestroy(clipList);
- }
- else
- RegionIntersect(prgnSrc, prgnSrc,
- &((WindowPtr) pSrcDrawable)->clipList);
- }
-
- box = *RegionExtents(prgnSrc);
- RegionTranslate(prgnSrc, -box.x1, -box.y1);
-
- if ((box.x2 > box.x1) && (box.y2 > box.y1)) {
- /* minimize the size of the data extracted */
- /* note that we convert the plane mask bitPlane into a plane number */
- box.x1 -= pSrcDrawable->x;
- box.x2 -= pSrcDrawable->x;
- box.y1 -= pSrcDrawable->y;
- box.y2 -= pSrcDrawable->y;
- ptile = miGetPlane(pSrcDrawable, ffs(bitPlane) - 1,
- box.x1, box.y1,
- box.x2 - box.x1, box.y2 - box.y1, (MiBits *) NULL);
- if (ptile) {
- miOpqStipDrawable(pDstDrawable, pGC, prgnSrc, ptile, 0,
- box.x2 - box.x1, box.y2 - box.y1,
- dstx + box.x1 - srcx, dsty + box.y1 - srcy);
- free(ptile);
- }
- }
- prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
- width, height, dstx, dsty, bitPlane);
- RegionDestroy(prgnSrc);
- return prgnExposed;
-}
-
/* 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),
--
1.9.3
More information about the xorg-devel
mailing list