Nothing ever set clientClip to anything but a region or NULL, so delete
the clientClipType field and change clientClip from (pointer) to
(RegionPtr).
Signed-off-by: Jamey Sharp<[email protected]>
---
dix/gc.c | 51 +++++++++----------------------------------
exa/exa_accel.c | 18 +++++++-------
exa/exa_priv.h | 6 ++--
exa/exa_unaccel.c | 6 ++--
hw/dmx/dmxgc.c | 50 ++++++++++++++++++-------------------------
hw/kdrive/src/kxv.c | 2 +-
hw/xfree86/common/xf86xv.c | 2 +-
hw/xfree86/xaa/xaaBitBlt.c | 4 +-
hw/xnest/GC.c | 44 ++++++++++++-------------------------
include/gcstruct.h | 5 +--
mi/micopy.c | 4 +-
mi/miexpose.c | 2 +-
mi/migc.c | 4 +-
mi/mioverlay.c | 2 +-
xfixes/region.c | 25 +++++++--------------
15 files changed, 81 insertions(+), 144 deletions(-)
diff --git a/dix/gc.c b/dix/gc.c
index e7568fc..d33f934 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -523,8 +523,7 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int
*pStatus,
pGC->graphicsExposures = TRUE;
pGC->clipOrg.x = 0;
pGC->clipOrg.y = 0;
- pGC->clientClipType = CT_NONE;
- pGC->clientClip = (pointer)NULL;
+ pGC->clientClip = NULL;
pGC->numInDashList = 2;
pGC->dash = DefaultDash;
pGC->dashOffset = 0;
@@ -836,7 +835,6 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
pGC->graphicsExposures = TRUE;
pGC->clipOrg.x = 0;
pGC->clipOrg.y = 0;
- pGC->clientClipType = CT_NONE;
pGC->dashOffset = 0;
pGC->numInDashList = 2;
pGC->dash = DefaultDash;
@@ -1087,22 +1085,10 @@ SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int
nrects,
static void
DestroyClip(GCPtr pGC)
{
- if (pGC->clientClipType == CT_NONE)
+ if (!pGC->clientClip)
return;
- else if (pGC->clientClipType == CT_PIXMAP)
- {
- (*pGC->pScreen->DestroyPixmap) ((PixmapPtr) (pGC->clientClip));
- }
- else
- {
- /*
- * we know we'll never have a list of rectangles, since ChangeClip
- * immediately turns them into a region
- */
- RegionDestroy(pGC->clientClip);
- }
+ RegionDestroy(pGC->clientClip);
pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
}
void
@@ -1112,8 +1098,7 @@ ChangeClip(GCPtr pGC, int type, pointer pvalue, int
nrects)
if (type == CT_PIXMAP)
{
/* convert the pixmap to a region */
- pGC->clientClip = (pointer) BitmapToRegion(pGC->pScreen,
- (PixmapPtr) pvalue);
+ pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue);
(*pGC->pScreen->DestroyPixmap) (pvalue);
}
else if (type == CT_REGION)
@@ -1123,35 +1108,21 @@ ChangeClip(GCPtr pGC, int type, pointer pvalue, int
nrects)
}
else if (type != CT_NONE)
{
- pGC->clientClip = (pointer) RegionFromRects(nrects,
- (xRectangle *) pvalue,
- type);
+ pGC->clientClip = RegionFromRects(nrects, (xRectangle *) pvalue, type);
free(pvalue);
}
- pGC->clientClipType = (type != CT_NONE&& pGC->clientClip) ? CT_REGION :
CT_NONE;
pGC->stateChanges |= GCClipMask;
}
static void
CopyClip(GCPtr pgcDst, GCPtr pgcSrc)
{
- RegionPtr prgnNew;
-
- switch (pgcSrc->clientClipType)
- {
- case CT_PIXMAP:
- ((PixmapPtr) pgcSrc->clientClip)->refcnt++;
- /* Fall through !! */
- case CT_NONE:
- ChangeClip(pgcDst, (int) pgcSrc->clientClipType,
- pgcSrc->clientClip, 0);
- break;
- case CT_REGION:
- prgnNew = RegionCreate(NULL, 1);
- RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
- ChangeClip(pgcDst, CT_REGION, prgnNew, 0);
- break;
- }
+ if (pgcSrc->clientClip) {
+ RegionPtr prgnNew = RegionCreate(NULL, 1);
+ RegionCopy(prgnNew, pgcSrc->clientClip);
+ ChangeClip(pgcDst, CT_REGION, prgnNew, 0);
+ } else
+ ChangeClip(pgcDst, CT_NONE, NULL, 0);
}
/*
diff --git a/exa/exa_accel.c b/exa/exa_accel.c
index 5600539..21e8741 100644
--- a/exa/exa_accel.c
+++ b/exa/exa_accel.c
@@ -421,7 +421,7 @@ exaHWCopyNtoN (DrawablePtr pSrcDrawable,
if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
pGC->fillStyle, pGC->alu,
- pGC->clientClipType)) {
+ pGC->clientClip)) {
dstregion = RegionCreate(NullBox, 0);
RegionCopy(dstregion, srcregion);
RegionTranslate(dstregion, dst_off_x - dx - src_off_x,
@@ -768,7 +768,7 @@ exaPolySegment (DrawablePtr pDrawable, GCPtr pGC, int nseg,
static Bool exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion,
Pixel pixel, CARD32 planemask, CARD32 alu,
- unsigned int clientClipType);
+ RegionPtr clientClip);
static void
exaPolyFillRect(DrawablePtr pDrawable,
@@ -816,11 +816,11 @@ exaPolyFillRect(DrawablePtr pDrawable,
if (((pGC->fillStyle == FillSolid || pGC->tileIsPixel)&&
exaFillRegionSolid(pDrawable, pReg, pGC->fillStyle == FillSolid ?
pGC->fgPixel : pGC->tile.pixel, pGC->planemask,
- pGC->alu, pGC->clientClipType)) ||
+ pGC->alu, pGC->clientClip)) ||
(pGC->fillStyle == FillTiled&& !pGC->tileIsPixel&&
exaFillRegionTiled(pDrawable, pReg, pGC->tile.pixmap,&pGC->patOrg,
pGC->planemask, pGC->alu,
- pGC->clientClipType))) {
+ pGC->clientClip))) {
goto out;
}
}
@@ -998,7 +998,7 @@ fallback:
static Bool
exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel
pixel,
- CARD32 planemask, CARD32 alu, unsigned int clientClipType)
+ CARD32 planemask, CARD32 alu, RegionPtr clientClip)
{
ExaScreenPriv(pDrawable->pScreen);
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
@@ -1019,7 +1019,7 @@ exaFillRegionSolid (DrawablePtr pDrawable, RegionPtr
pRegion, Pixel pixel,
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask,
FillSolid,
- alu, clientClipType) ? NULL :
pRegion;
+ alu, clientClip) ? NULL :
pRegion;
exaDoMigration (pixmaps, 1, TRUE);
}
@@ -1084,7 +1084,7 @@ out:
Bool
exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile,
DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
- unsigned int clientClipType)
+ RegionPtr clientClip)
{
ExaScreenPriv(pDrawable->pScreen);
PixmapPtr pPixmap;
@@ -1106,7 +1106,7 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr
pRegion, PixmapPtr pTile,
if (tileWidth == 1&& tileHeight == 1)
return exaFillRegionSolid(pDrawable, pRegion,
exaGetPixmapFirstPixel (pTile), planemask,
- alu, clientClipType);
+ alu, clientClip);
pPixmap = exaGetDrawablePixmap (pDrawable);
pExaPixmap = ExaGetPixmapPriv (pPixmap);
@@ -1122,7 +1122,7 @@ exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr
pRegion, PixmapPtr pTile,
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = exaGCReadsDestination(pDrawable, planemask,
FillTiled,
- alu, clientClipType) ? NULL :
pRegion;
+ alu, clientClip) ? NULL :
pRegion;
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pTile;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index 70de4bd..64b2671 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -449,11 +449,11 @@ ExaCheckAddTraps (PicturePtr pPicture,
static _X_INLINE Bool
exaGCReadsDestination(DrawablePtr pDrawable, unsigned long planemask,
unsigned int fillStyle, unsigned char alu,
- unsigned int clientClipType)
+ RegionPtr clientClip)
{
return ((alu != GXcopy&& alu != GXclear&& alu != GXset&&
alu != GXcopyInverted) || fillStyle == FillStippled ||
- clientClipType != CT_NONE || !EXA_PM_IS_SOLID(pDrawable,
planemask));
+ clientClip != NullRegion || !EXA_PM_IS_SOLID(pDrawable, planemask));
}
void
@@ -462,7 +462,7 @@ exaCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
RegionPtr prgnSrc);
Bool
exaFillRegionTiled (DrawablePtr pDrawable, RegionPtr pRegion,
PixmapPtr pTile,
DDXPointPtr pPatOrg, CARD32 planemask, CARD32 alu,
- unsigned int clientClipType);
+ RegionPtr clientClip);
void
exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 219f903..9f237e9 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -106,7 +106,7 @@ ExaCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int
depth,
EXA_FALLBACK(("to %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
if (!pExaScr->prepare_access_reg || !pExaPixmap->pDamage ||
exaGCReadsDestination(pDrawable, pGC->planemask, pGC->fillStyle,
- pGC->alu, pGC->clientClipType))
+ pGC->alu, pGC->clientClip))
exaPrepareAccess (pDrawable, EXA_PREPARE_DEST);
else
pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_DEST,
@@ -139,7 +139,7 @@ ExaCheckCopyNtoN (DrawablePtr pSrc, DrawablePtr pDst,
GCPtr pGC,
if (pExaScr->prepare_access_reg&&
!exaGCReadsDestination(pDst, pGC->planemask, pGC->fillStyle,
- pGC->alu, pGC->clientClipType)&&
+ pGC->alu, pGC->clientClip)&&
RegionInitBoxes (®, pbox, nbox)) {
PixmapPtr pPixmap = exaGetDrawablePixmap(pDst);
@@ -175,7 +175,7 @@ ExaFallbackPrepareReg(DrawablePtr pDrawable,
pGC->planemask,
pGC->fillStyle,
pGC->alu,
- pGC->clientClipType))) {
+ pGC->clientClip))) {
BoxRec box;
RegionRec reg;
int xoff, yoff;
diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c
index b1347c1..8ec9b22 100644
--- a/hw/dmx/dmxgc.c
+++ b/hw/dmx/dmxgc.c
@@ -188,38 +188,30 @@ static void dmxBEChangeClip(GCPtr pGC)
ScreenPtr pScreen = pGC->pScreen;
DMXScreenInfo *dmxScreen =&dmxScreens[pScreen->myNum];
dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
- XRectangle *pRects;
- BoxPtr pBox;
- int i, nRects;
- /* Set the client clip on the back-end server */
- switch (pGC->clientClipType) {
- case CT_NONE:
- if (dmxScreen->beDisplay)
- XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
- break;
+ if (!dmxScreen->beDisplay)
+ return;
- case CT_REGION:
- if (dmxScreen->beDisplay) {
- nRects = RegionNumRects((RegionPtr)pGC->clientClip);
- pRects = malloc(nRects * sizeof(*pRects));
- pBox = RegionRects((RegionPtr)pGC->clientClip);
-
- for (i = 0; i< nRects; i++) {
- pRects[i].x = pBox[i].x1;
- pRects[i].y = pBox[i].y1;
- pRects[i].width = pBox[i].x2 - pBox[i].x1;
- pRects[i].height = pBox[i].y2 - pBox[i].y1;
- }
-
- XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
- pGC->clipOrg.x, pGC->clipOrg.y,
- pRects, nRects, Unsorted);
-
- free(pRects);
+ /* Set the client clip on the back-end server */
+ if (pGC->clientClip) {
+ int i, nRects = RegionNumRects(pGC->clientClip);
+ XRectangle *pRects = malloc(nRects * sizeof(*pRects));
+ BoxPtr pBox = RegionRects(pGC->clientClip);
+
+ for (i = 0; i< nRects; i++) {
+ pRects[i].x = pBox[i].x1;
+ pRects[i].y = pBox[i].y1;
+ pRects[i].width = pBox[i].x2 - pBox[i].x1;
+ pRects[i].height = pBox[i].y2 - pBox[i].y1;
}
- break;
- }
+
+ XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc,
+ pGC->clipOrg.x, pGC->clipOrg.y,
+ pRects, nRects, Unsorted);
+
+ free(pRects);
+ } else
+ XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None);
}
/** Set the values in the graphics context on the back-end server
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 50dc235..fcd2ebb 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -630,7 +630,7 @@ KdXVCopyClip(
GCPtr pGC
){
/* copy the new clip if it exists */
- if((pGC->clientClipType == CT_REGION)&& pGC->clientClip) {
+ if(pGC->clientClip) {
if(!portPriv->clientClip)
portPriv->clientClip = RegionCreate(NullBox, 1);
/* Note: this is in window coordinates */
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index b46dfef..c5ac9f5 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -695,7 +695,7 @@ xf86XVCopyClip(
GCPtr pGC
){
/* copy the new clip if it exists */
- if((pGC->clientClipType == CT_REGION)&& pGC->clientClip) {
+ if(pGC->clientClip) {
if(!portPriv->clientClip)
portPriv->clientClip = RegionCreate(NullBox, 1);
/* Note: this is in window coordinates */
diff --git a/hw/xfree86/xaa/xaaBitBlt.c b/hw/xfree86/xaa/xaaBitBlt.c
index 049dbfb..3d50b90 100644
--- a/hw/xfree86/xaa/xaaBitBlt.c
+++ b/hw/xfree86/xaa/xaaBitBlt.c
@@ -65,7 +65,7 @@ XAABitBlt(
/* clip the source */
if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
- if ((pSrcDrawable == pDstDrawable)&& (pGC->clientClipType == CT_NONE))
+ if ((pSrcDrawable == pDstDrawable)&& !pGC->clientClip)
prgnSrcClip = pGC->pCompositeClip;
else
fastClip = 1;
@@ -78,7 +78,7 @@ XAABitBlt(
*/
fastClip = 1;
} else if ((pSrcDrawable == pDstDrawable)&&
- (pGC->clientClipType == CT_NONE)) {
+ !pGC->clientClip) {
prgnSrcClip = pGC->pCompositeClip;
} else {
prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
diff --git a/hw/xnest/GC.c b/hw/xnest/GC.c
index 579350b..ac99ffd 100644
--- a/hw/xnest/GC.c
+++ b/hw/xnest/GC.c
@@ -90,37 +90,21 @@ xnestValidateGC(GCPtr pGC, unsigned long changes,
DrawablePtr pDrawable)
static void
xnestChangeClip(GCPtr pGC)
{
- int i, size, nRects;
- BoxPtr pBox;
- XRectangle *pRects;
-
- switch(pGC->clientClipType)
- {
- case CT_NONE:
- XSetClipMask(xnestDisplay, xnestGC(pGC), None);
- break;
-
- case CT_REGION:
- nRects = RegionNumRects((RegionPtr) pGC->clientClip);
- size = nRects * sizeof(*pRects);
- pRects = (XRectangle *) malloc(size);
- pBox = RegionRects((RegionPtr) pGC->clientClip);
- for (i = nRects; i--> 0; ) {
- pRects[i].x = pBox[i].x1;
- pRects[i].y = pBox[i].y1;
- pRects[i].width = pBox[i].x2 - pBox[i].x1;
- pRects[i].height = pBox[i].y2 - pBox[i].y1;
- }
- XSetClipRectangles(xnestDisplay, xnestGC(pGC), 0, 0,
- pRects, nRects, Unsorted);
- free((char *) pRects);
- break;
-
- case CT_PIXMAP:
- XSetClipMask(xnestDisplay, xnestGC(pGC),
- xnestPixmap((PixmapPtr) pGC->clientClip));
- break;
+ if (pGC->clientClip) {
+ int i, nRects = RegionNumRects((RegionPtr) pGC->clientClip);
+ XRectangle *pRects = malloc(nRects * sizeof(*pRects));
+ BoxPtr pBox = RegionRects((RegionPtr) pGC->clientClip);
+ for (i = nRects; i--> 0; ) {