diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2019-10-22 21:44:03 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2020-01-05 22:37:35 +0100 |
commit | 95940104a1695f3f334328bcca66da3c37d04ddf (patch) | |
tree | aaf6291fdb664d57f7c3b49ef2b59053f5bd3b4e | |
parent | 0e2b7479cd4567128fbcd975e5376744d78cd416 (diff) | |
download | nx-libs-95940104a1695f3f334328bcca66da3c37d04ddf.tar.gz nx-libs-95940104a1695f3f334328bcca66da3c37d04ddf.tar.bz2 nx-libs-95940104a1695f3f334328bcca66da3c37d04ddf.zip |
GCOps.c: scope improvements
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 107 |
1 files changed, 43 insertions, 64 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 7db1aff58..f776a368d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -216,17 +216,12 @@ RegionPtr nxagentBitBlitHelper(GC *pGC) int nxagentWindowIsPopup(DrawablePtr pDrawable) { - WindowPtr parent; - - int windowIsPopup; - int level; - if (pDrawable -> type != DRAWABLE_WINDOW) { return 0; } - windowIsPopup = 0; + int windowIsPopup = 0; if (((WindowPtr) pDrawable) -> overrideRedirect == 1) { @@ -234,7 +229,7 @@ int nxagentWindowIsPopup(DrawablePtr pDrawable) } else { - parent = ((WindowPtr) pDrawable) -> parent; + WindowPtr parent = ((WindowPtr) pDrawable) -> parent; /* * Go up on the tree until a parent @@ -243,7 +238,7 @@ int nxagentWindowIsPopup(DrawablePtr pDrawable) * up children's popup. */ - level = 0; + int level = 0; while (parent != NULL && ++level <= 4) { @@ -255,7 +250,6 @@ int nxagentWindowIsPopup(DrawablePtr pDrawable) if (parent -> overrideRedirect == 1) { windowIsPopup = 1; - break; } @@ -280,10 +274,6 @@ int nxagentDeferCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { - RegionPtr pSrcRegion; - RegionPtr pClipRegion, pCorruptedRegion; - RegionRec corruptedRegion, tmpRegion; - /* * If the destination drawable is a popup * window, we try to synchronize the source @@ -306,7 +296,7 @@ FIXME: The popup could be synchronized with one nxagentPixmapContainTrapezoids((PixmapPtr) pSrcDrawable) == 1 && nxagentWindowIsPopup(pDstDrawable) == 1) { - pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); + RegionPtr pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Copying to a popup menu. Source region [%d,%d,%d,%d].\n", @@ -314,6 +304,8 @@ FIXME: The popup could be synchronized with one pSrcRegion -> extents.x2, pSrcRegion -> extents.y2); #endif + RegionRec corruptedRegion; + RegionInit(&corruptedRegion, NullBox, 1); RegionIntersect(&corruptedRegion, @@ -349,8 +341,8 @@ FIXME: The popup could be synchronized with one if ((pDstDrawable -> type == DRAWABLE_PIXMAP && nxagentOption(DeferLevel) > 0) || nxagentOption(DeferLevel) >= 3) { - pClipRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, - width, height); + RegionPtr pClipRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, + width, height); /* * We called this variable pCorruptedRegion @@ -360,8 +352,8 @@ FIXME: The popup could be synchronized with one * narrow the destination. */ - pCorruptedRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, - width, height); + RegionPtr pCorruptedRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, + width, height); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Copy area source region is [%d,%d,%d,%d].\n", @@ -393,6 +385,8 @@ FIXME: The popup could be synchronized with one } else { + RegionRec tmpRegion; + RegionInit(&tmpRegion, NullBox, 1); #ifdef DEBUG @@ -455,10 +449,6 @@ FIXME: The popup could be synchronized with one if (RegionNil(pClipRegion) == 0) { - GCPtr targetGC; - - CARD32 targetAttributes[2]; - Bool pClipRegionFree = True; /* @@ -468,7 +458,7 @@ FIXME: The popup could be synchronized with one * setting a new clip mask. */ - targetGC = GetScratchGC(pDstDrawable -> depth, pDstDrawable -> pScreen); + GCPtr targetGC = GetScratchGC(pDstDrawable -> depth, pDstDrawable -> pScreen); ValidateGC(pDstDrawable, targetGC); @@ -495,6 +485,8 @@ FIXME: The popup could be synchronized with one } else { + CARD32 targetAttributes[2]; + /* * Setting the clip mask origin. This * operation must precede the clip chan- @@ -563,7 +555,9 @@ FIXME: The popup could be synchronized with one } else { - pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); + RegionPtr pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); + + RegionRec corruptedRegion; #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Source region [%d,%d,%d,%d].\n", @@ -598,12 +592,6 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) { - int leftPad = 0; - unsigned int format; - unsigned long planeMask = 0xffffffff; - - RegionPtr pDstRegion; - int skip = 0; #ifdef TEST @@ -754,13 +742,14 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, nxagentIsShmPixmap((PixmapPtr) pSrcDrawable)) { char *data; - int depth, length; - depth = pSrcDrawable -> depth; + int depth = pSrcDrawable -> depth; - format = (depth == 1) ? XYPixmap : ZPixmap; + unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; - length = nxagentImageLength(width, height, format, leftPad, depth); + int leftPad = 0; + + int length = nxagentImageLength(width, height, format, leftPad, depth); if ((data = malloc(length)) == NULL) { @@ -771,6 +760,8 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, return NullRegion; } + unsigned long planeMask = 0xffffffff; + fbGetImage(nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height, format, planeMask, data); /* @@ -831,7 +822,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, if (nxagentDrawableStatus(pDstDrawable) == NotSynchronized) { - pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); + RegionPtr pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion); @@ -918,13 +909,6 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long plane) { - unsigned int format; - int leftPad = 0; - unsigned long planeMask = 0xffffffff; - - RegionPtr pSrcRegion, pDstRegion; - RegionRec corruptedRegion; - int skip = 0; #ifdef TEST @@ -974,13 +958,14 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, nxagentIsShmPixmap((PixmapPtr) pSrcDrawable)) { char *data; - int depth, length; - depth = pSrcDrawable -> depth; + int depth = pSrcDrawable -> depth; + + unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; - format = (depth == 1) ? XYPixmap : ZPixmap; + int leftPad = 0; - length = nxagentImageLength(width, height, format, leftPad, depth); + int length = nxagentImageLength(width, height, format, leftPad, depth); if ((data = malloc(length)) == NULL) { @@ -991,6 +976,8 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, return 0; } + unsigned long planeMask = 0xffffffff; + fbGetImage(nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height, format, planeMask, data); /* @@ -1024,7 +1011,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, if (pDstDrawable -> type == DRAWABLE_PIXMAP && nxagentOption(DeferLevel) > 0) { - pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); + RegionPtr pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); nxagentMarkCorruptedRegion(pDstDrawable, pDstRegion); @@ -1034,7 +1021,9 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, } else { - pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); + RegionPtr pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); + + RegionRec corruptedRegion; RegionInit(&corruptedRegion, NullBox, 1); @@ -1050,7 +1039,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, nxagentSynchronizeRegion(pSrcDrawable, &corruptedRegion /*pSrcRegion*/, NEVER_BREAK, NULL); - pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); + RegionPtr pDstRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, width, height); nxagentUnmarkCorruptedRegion(pDstDrawable, pDstRegion); @@ -1471,8 +1460,6 @@ void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, if (mode == CoordModeOrigin) { - int i; - mode = CoordModePrevious; newPoints = malloc(nPoints * sizeof(xPoint)); @@ -1491,7 +1478,7 @@ void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, * tive to the previous point. */ - for (i = 1; i < nPoints; i++) + for (int i = 1; i < nPoints; i++) { newPoints[i].x = pPoints[i].x - pPoints[i-1].x; newPoints[i].y = pPoints[i].y - pPoints[i-1].y; @@ -1551,10 +1538,6 @@ void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles, xRectangle *pRectangles) { - RegionPtr rectRegion; - - int inheritCorruptedRegion; - #ifdef TEST if (nRectangles == 1) @@ -1594,7 +1577,7 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, * intersecting the target will be cleared. */ - inheritCorruptedRegion = 0; + int inheritCorruptedRegion = 0; if (pGC -> fillStyle == FillTiled && pGC -> tileIsPixel == 0 && pGC -> tile.pixmap != NULL) @@ -1616,7 +1599,7 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, if (inheritCorruptedRegion == 1 || nxagentDrawableStatus(pDrawable) == NotSynchronized) { - rectRegion = RegionFromRects(nRectangles, pRectangles, CT_REGION); + RegionPtr rectRegion = RegionFromRects(nRectangles, pRectangles, CT_REGION); if (pGC -> clientClip != NULL) { @@ -1784,8 +1767,6 @@ void nxagentPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string) { - int width; - /* * While the session is suspended * the font structure is NULL. @@ -1796,7 +1777,7 @@ int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, return x; } - width = XTextWidth(nxagentFontStruct(pGC->font), string, count); + int width = XTextWidth(nxagentFontStruct(pGC->font), string, count); if (nxagentGCTrap == 1) { @@ -1857,8 +1838,6 @@ int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int nxagentPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string) { - int width; - /* * While the session is suspended * the font structure is NULL. @@ -1869,7 +1848,7 @@ int nxagentPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, return x; } - width = XTextWidth16(nxagentFontStruct(pGC->font), (XChar2b *)string, count); + int width = XTextWidth16(nxagentFontStruct(pGC->font), (XChar2b *)string, count); if (nxagentGCTrap == 1) { |