summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2014-06-20 13:31:20 -0400
committerAdam Jackson <ajax@redhat.com>2014-10-27 15:46:05 -0400
commit73e2383b7350723256894c5076d0c731aec5cd1f (patch)
tree1ceac2d3dbec5820802ce3be12fac72b754cce20 /mi
parente7b9295551d55b42b416ba70cce11dae79ece5e7 (diff)
dix: Always store GC client clip as a region (v2)
Again, this changes FixesCreateRegionFromGC to throw BadMatch when fed a GC with no client clip. v2: Fix Xnest and some variable names (Keith) Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'mi')
-rw-r--r--mi/micopy.c5
-rw-r--r--mi/miexpose.c2
-rw-r--r--mi/migc.c45
-rw-r--r--mi/mioverlay.c2
4 files changed, 14 insertions, 40 deletions
diff --git a/mi/micopy.c b/mi/micopy.c
index a52b0a786..2409c7880 100644
--- a/mi/micopy.c
+++ b/mi/micopy.c
@@ -167,7 +167,7 @@ miDoCopy(DrawablePtr pSrcDrawable,
/* Compute source clip region */
if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
- if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+ if ((pSrcDrawable == pDstDrawable) && (!pGC->clientClip))
prgnSrcClip = miGetCompositeClip(pGC);
else
fastSrc = TRUE;
@@ -186,8 +186,7 @@ miDoCopy(DrawablePtr pSrcDrawable,
*/
fastSrc = TRUE;
}
- else if ((pSrcDrawable == pDstDrawable) &&
- (pGC->clientClipType == CT_NONE)) {
+ else if ((pSrcDrawable == pDstDrawable) && (!pGC->clientClip)) {
prgnSrcClip = miGetCompositeClip(pGC);
}
else {
diff --git a/mi/miexpose.c b/mi/miexpose.c
index de8ee6c2a..e74b9c37e 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -230,7 +230,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip);
/* intersect with client clip region. */
- if (pGC->clientClipType == CT_REGION)
+ if (pGC->clientClip)
RegionIntersect(&rgnExposed, &rgnExposed, pGC->clientClip);
/*
diff --git a/mi/migc.c b/mi/migc.c
index 9bbe8846e..8fdd4810c 100644
--- a/mi/migc.c
+++ b/mi/migc.c
@@ -55,20 +55,9 @@ miDestroyGC(GCPtr pGC)
void
miDestroyClip(GCPtr pGC)
{
- if (pGC->clientClipType == CT_NONE)
- 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
- */
+ if (pGC->clientClip)
RegionDestroy(pGC->clientClip);
- }
pGC->clientClip = NULL;
- pGC->clientClipType = CT_NONE;
}
void
@@ -77,8 +66,7 @@ miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
(*pGC->funcs->DestroyClip) (pGC);
if (type == CT_PIXMAP) {
/* convert the pixmap to a region */
- pGC->clientClip = (void *) BitmapToRegion(pGC->pScreen,
- (PixmapPtr) pvalue);
+ pGC->clientClip = BitmapToRegion(pGC->pScreen, (PixmapPtr) pvalue);
(*pGC->pScreen->DestroyPixmap) (pvalue);
}
else if (type == CT_REGION) {
@@ -86,34 +74,21 @@ miChangeClip(GCPtr pGC, int type, void *pvalue, int nrects)
pGC->clientClip = pvalue;
}
else if (type != CT_NONE) {
- pGC->clientClip = (void *) 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;
}
void
miCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
{
- RegionPtr prgnNew;
-
- switch (pgcSrc->clientClipType) {
- case CT_PIXMAP:
- ((PixmapPtr) pgcSrc->clientClip)->refcnt++;
- /* Fall through !! */
- case CT_NONE:
- (*pgcDst->funcs->ChangeClip) (pgcDst, (int) pgcSrc->clientClipType,
- pgcSrc->clientClip, 0);
- break;
- case CT_REGION:
- prgnNew = RegionCreate(NULL, 1);
+ if (pgcSrc->clientClip) {
+ RegionPtr prgnNew = RegionCreate(NULL, 1);
RegionCopy(prgnNew, (RegionPtr) (pgcSrc->clientClip));
- (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (void *) prgnNew, 0);
- break;
+ (*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, prgnNew, 0);
+ } else {
+ (*pgcDst->funcs->ChangeClip) (pgcDst, CT_NONE, NULL, 0);
}
}
@@ -149,7 +124,7 @@ miComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable)
* regions. (this wins especially if many clients clip by children
* and have no client clip.)
*/
- if (pGC->clientClipType == CT_NONE) {
+ if (!pGC->clientClip) {
if (freeCompClip)
RegionDestroy(pGC->pCompositeClip);
pGC->pCompositeClip = pregWin;
@@ -206,7 +181,7 @@ miComputeCompositeClip(GCPtr pGC, DrawablePtr pDrawable)
pGC->pCompositeClip = RegionCreate(&pixbounds, 1);
}
- if (pGC->clientClipType == CT_REGION) {
+ if (pGC->clientClip) {
if (pDrawable->x || pDrawable->y) {
RegionTranslate(pGC->clientClip,
pDrawable->x + pGC->clipOrg.x,
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index eb8dda133..2b20fd72f 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -1667,7 +1667,7 @@ miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
freeTmpClip = FALSE;
}
freeCompClip = pGC->freeCompClip;
- if (pGC->clientClipType == CT_NONE) {
+ if (!pGC->clientClip) {
if (freeCompClip)
RegionDestroy(pGC->pCompositeClip);
pGC->pCompositeClip = pregWin;