diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-06-08 17:06:32 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2011-12-14 17:17:35 -0800 |
commit | 5a70cf630b8777a665363c7efc8861137109d6fc (patch) | |
tree | de925427c308c386c886628b493eb55e1424d340 | |
parent | c1e65b6eee53484d49bc10074927c8a6e28a8cde (diff) |
Make GC clientClip always be a region, and bump video ABI to 13.reviewedcleanup-gcclip
Nothing ever set clientClip to anything but a region or NULL, so delete
the clientClipType field and change clientClip from (pointer) to
(RegionPtr).
The ABI break from both this commit and the previous one ("Quit wrapping
ChangeClip, CopyClip, and DestroyClip in GCFuncs") is reflected by
bumping the video ABI version.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
-rw-r--r-- | dix/gc.c | 51 | ||||
-rw-r--r-- | exa/exa_accel.c | 18 | ||||
-rw-r--r-- | exa/exa_priv.h | 6 | ||||
-rw-r--r-- | exa/exa_unaccel.c | 6 | ||||
-rw-r--r-- | hw/dmx/dmxgc.c | 50 | ||||
-rw-r--r-- | hw/kdrive/src/kxv.c | 2 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Module.h | 2 | ||||
-rw-r--r-- | hw/xfree86/common/xf86xv.c | 2 | ||||
-rw-r--r-- | hw/xfree86/xaa/xaaBitBlt.c | 4 | ||||
-rw-r--r-- | hw/xnest/GC.c | 44 | ||||
-rw-r--r-- | include/gc.h | 2 | ||||
-rw-r--r-- | include/gcstruct.h | 5 | ||||
-rw-r--r-- | mi/micopy.c | 4 | ||||
-rw-r--r-- | mi/miexpose.c | 2 | ||||
-rw-r--r-- | mi/migc.c | 4 | ||||
-rw-r--r-- | mi/mioverlay.c | 2 | ||||
-rw-r--r-- | xfixes/region.c | 25 |
17 files changed, 83 insertions, 146 deletions
@@ -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 5600539d6..21e874181 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 70de4bd6f..64b2671e7 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 219f903b2..9f237e9cc 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 b1347c106..8ec9b22da 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 50dc23529..fcd2ebb7e 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/xf86Module.h b/hw/xfree86/common/xf86Module.h index d35464351..12cb1f6c1 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -82,7 +82,7 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(12, 0) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(13, 0) #define ABI_XINPUT_VERSION SET_ABI_VERSION(15, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(6, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index b46dfefed..c5ac9f56d 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 049dbfbe7..3d50b90cb 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 579350b19..5f9d224ca 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; ) { + 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(pRects); + } else + XSetClipMask(xnestDisplay, xnestGC(pGC), None); } void diff --git a/include/gc.h b/include/gc.h index 2079cfae0..a28b41956 100644 --- a/include/gc.h +++ b/include/gc.h @@ -54,7 +54,7 @@ SOFTWARE. #include "screenint.h" /* for ScreenPtr */ #include "pixmap.h" /* for DrawablePtr */ -/* clientClipType field in GC */ +/* clip type argument for ChangeClip */ #define CT_NONE 0 #define CT_PIXMAP 1 #define CT_REGION 2 diff --git a/include/gcstruct.h b/include/gcstruct.h index fb9ee0df9..ed598fc21 100644 --- a/include/gcstruct.h +++ b/include/gcstruct.h @@ -278,13 +278,12 @@ typedef struct _GC { unsigned int arcMode : 1; unsigned int subWindowMode : 1; unsigned int graphicsExposures : 1; - unsigned int clientClipType : 2; /* CT_<kind> */ unsigned int miTranslate:1; /* should mi things translate? */ unsigned int tileIsPixel:1; /* tile is solid pixel */ unsigned int fExpose:1; /* Call exposure handling */ unsigned int freeCompClip:1; /* Free composite clip */ unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */ - unsigned int unused:13; /* see comment above */ + unsigned int unused:15; /* see comment above */ unsigned long planemask; unsigned long fgPixel; unsigned long bgPixel; @@ -297,7 +296,7 @@ typedef struct _GC { DDXPointRec patOrg; /* origin for (tile, stipple) */ struct _Font *font; DDXPointRec clipOrg; - pointer clientClip; + RegionPtr clientClip; unsigned long stateChanges; /* masked with GC_<kind> */ unsigned long serialNumber; GCFuncs *funcs; diff --git a/mi/micopy.c b/mi/micopy.c index 652c6207e..2fb40f5f6 100644 --- a/mi/micopy.c +++ b/mi/micopy.c @@ -192,7 +192,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; @@ -215,7 +215,7 @@ miDoCopy (DrawablePtr pSrcDrawable, fastSrc = TRUE; } else if ((pSrcDrawable == pDstDrawable) && - (pGC->clientClipType == CT_NONE)) + !pGC->clientClip) { prgnSrcClip = miGetCompositeClip(pGC); } diff --git a/mi/miexpose.c b/mi/miexpose.c index 0f1ebe59c..ce02b1341 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -251,7 +251,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); /* @@ -88,7 +88,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); @@ -155,7 +155,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, diff --git a/mi/mioverlay.c b/mi/mioverlay.c index 766c5e7f7..fe2063db7 100644 --- a/mi/mioverlay.c +++ b/mi/mioverlay.c @@ -1745,7 +1745,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; diff --git a/xfixes/region.c b/xfixes/region.c index 606bf7ada..701733436 100644 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -210,7 +210,7 @@ SProcXFixesCreateRegionFromWindow (ClientPtr client) int ProcXFixesCreateRegionFromGC (ClientPtr client) { - RegionPtr pRegion, pClip; + RegionPtr pRegion; GCPtr pGC; int rc; REQUEST (xXFixesCreateRegionFromGCReq); @@ -221,23 +221,14 @@ ProcXFixesCreateRegionFromGC (ClientPtr client) rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess); if (rc != Success) return rc; - - switch (pGC->clientClipType) { - case CT_PIXMAP: - pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip); - if (!pRegion) - return BadAlloc; - break; - case CT_REGION: - pClip = (RegionPtr) pGC->clientClip; - pRegion = XFixesRegionCopy (pClip); - if (!pRegion) - return BadAlloc; - break; - default: + + if (!pGC->clientClip) return BadImplementation; /* assume sane server bits */ - } - + + pRegion = XFixesRegionCopy (pGC->clientClip); + if (!pRegion) + return BadAlloc; + if (!AddResource (stuff->region, RegionResType, (pointer) pRegion)) return BadAlloc; |