From 95940104a1695f3f334328bcca66da3c37d04ddf Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 22 Oct 2019 21:44:03 +0200 Subject: GCOps.c: scope improvements --- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 107 ++++++++++++----------------- 1 file changed, 43 insertions(+), 64 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/GCOps.c') 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) { -- cgit v1.2.3 From b9a4dea51a5e9390abef9ef4d029fd44532f0fff Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 22 Oct 2019 21:55:08 +0200 Subject: GCOps.c: reformat comments save some lines --- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 198 ++++++++++++----------------- 1 file changed, 84 insertions(+), 114 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/GCOps.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index f776a368d..450a3c24f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -192,9 +192,8 @@ RegionPtr nxagentBitBlitHelper(GC *pGC) #endif /* - * Force NullRegion. We consider enough the graphics - * expose events generated internally by the nxagent - * server. + * Force NullRegion. We consider enough the graphics expose events + * generated internally by the nxagent server. */ #ifdef TEST @@ -205,13 +204,12 @@ RegionPtr nxagentBitBlitHelper(GC *pGC) } /* - * The deferring of X_RenderCompositeTrapezoids caused - * an ugly effect on pulldown menu: as the background - * may be not synchronized, the text floats in an invi- - * sible window. To avoid such effects, we use a system - * to guess if the destination target of a copy area - * is a popup, by assuming that those kind of windows - * use the override redirect property. + * The deferring of X_RenderCompositeTrapezoids caused an ugly effect + * on pulldown menu: as the background may be not synchronized, the + * text floats in an invisible window. To avoid such effects, we use a + * system to guess if the destination target of a copy area is a + * popup, by assuming that those kind of windows use the override + * redirect property. */ int nxagentWindowIsPopup(DrawablePtr pDrawable) @@ -232,10 +230,8 @@ int nxagentWindowIsPopup(DrawablePtr pDrawable) WindowPtr parent = ((WindowPtr) pDrawable) -> parent; /* - * Go up on the tree until a parent - * exists or 4 windows has been che- - * cked. This seems a good limit to - * up children's popup. + * Go up on the tree until a parent exists or 4 windows has been + * checked. This seems a good limit to up children's popup. */ int level = 0; @@ -266,8 +262,7 @@ int nxagentWindowIsPopup(DrawablePtr pDrawable) } /* - * This function returns 1 if the - * XCopyArea request must be skipped. + * This function returns 1 if the XCopyArea request must be skipped. */ int nxagentDeferCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, @@ -275,20 +270,17 @@ int nxagentDeferCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, int height, int dstx, int dsty) { /* - * If the destination drawable is a popup - * window, we try to synchronize the source - * drawable to show a nice menu. Anyway if - * this synchronization breaks, the copy area - * is handled in the normal way. + * If the destination drawable is a popup window, we try to + * synchronize the source drawable to show a nice menu. Anyway if + * this synchronization breaks, the copy area is handled in the + * normal way. */ /* -FIXME: The popup could be synchronized with one - single put image, clipped to the corrup- - ted region. As an intermediate step, the - pixmap to synchronize could be copied on - a cleared scratch pixmap, in order to - have a solid color in the clipped regions. +FIXME: The popup could be synchronized with one single put image, + clipped to the corrupted region. As an intermediate step, the + pixmap to synchronize could be copied on a cleared scratch + pixmap, in order to have a solid color in the clipped regions. */ if (nxagentOption(DeferLevel) >= 2 && @@ -332,10 +324,9 @@ FIXME: The popup could be synchronized with one } /* - * We are going to decide if the source drawable - * must be synchronized before using it, or if - * the copy will be clipped to the synchronized - * source region. + * We are going to decide if the source drawable must be + * synchronized before using it, or if the copy will be clipped to + * the synchronized source region. */ if ((pDstDrawable -> type == DRAWABLE_PIXMAP && @@ -345,11 +336,9 @@ FIXME: The popup could be synchronized with one width, height); /* - * We called this variable pCorruptedRegion - * because in the worst case the corrupted - * region will be equal to the destination - * region. The GC's clip mask is used to - * narrow the destination. + * We called this variable pCorruptedRegion because in the worst + * case the corrupted region will be equal to the destination + * region. The GC's clip mask is used to narrow the destination. */ RegionPtr pCorruptedRegion = nxagentCreateRegion(pDstDrawable, pGC, dstx, dsty, @@ -413,9 +402,8 @@ FIXME: The popup could be synchronized with one } /* - * The corrupted region on the destination - * drawable is composed by the areas of the - * destination that we are not going to copy. + * The corrupted region on the destination drawable is composed by + * the areas of the destination that we are not going to copy. */ RegionSubtract(pCorruptedRegion, pCorruptedRegion, pClipRegion); @@ -433,8 +421,8 @@ FIXME: The popup could be synchronized with one #endif /* - * The destination drawable inherits both the - * synchronized and the corrupted region. + * The destination drawable inherits both the synchronized and the + * corrupted region. */ if (RegionNil(pClipRegion) == 0) @@ -452,9 +440,8 @@ FIXME: The popup could be synchronized with one Bool pClipRegionFree = True; /* - * As we want to copy only the synchronized - * areas of the source drawable, we create - * a new GC copying the original one and + * As we want to copy only the synchronized areas of the source + * drawable, we create a new GC copying the original one and * setting a new clip mask. */ @@ -488,10 +475,9 @@ FIXME: The popup could be synchronized with one CARD32 targetAttributes[2]; /* - * Setting the clip mask origin. This - * operation must precede the clip chan- - * ge, because the origin information is - * used in the XSetClipRectangles(). + * Setting the clip mask origin. This operation must precede + * the clip change, because the origin information is used in + * the XSetClipRectangles(). */ targetAttributes[0] = 0; @@ -506,8 +492,8 @@ FIXME: The popup could be synchronized with one nxagentChangeClip(targetGC, CT_REGION, pClipRegion, 0); /* - * Next call to nxagentChangeClip() will destroy - * pClipRegion, so it has not to be freed. + * Next call to nxagentChangeClip() will destroy pClipRegion, + * so it has not to be freed. */ pClipRegionFree = False; @@ -541,9 +527,8 @@ FIXME: The popup could be synchronized with one #endif /* - * The pClipRegion is destroyed calling nxagentChangeClip(), - * so we deallocate it explicitly only if we don't change - * the clip. + * The pClipRegion is destroyed calling nxagentChangeClip(), so + * we deallocate it explicitly only if we don't change the clip. */ nxagentFreeRegion(pSrcDrawable, pClipRegion); @@ -602,9 +587,9 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, #endif /* - * Here, before using fbDoCopy() called by fbCopyArea(), - * it should be provided that the cast in fbDoCopy() from - * int to short int would not cut off significative bits. + * Here, before using fbDoCopy() called by fbCopyArea(), it should be + * provided that the cast in fbDoCopy() from int to short int would + * not cut off significative bits. */ if (dstx + pDstDrawable->x + width > 32767) @@ -713,9 +698,9 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, } /* - * Try to detect if the copy area is to a window - * that is unmapped or fully covered. Similarly - * to the check in Image.c, this is of little use. + * Try to detect if the copy area is to a window that is unmapped or + * fully covered. Similarly to the check in Image.c, this is of + * little use. */ if (nxagentOption(IgnoreVisibility) == 0 && pDstDrawable -> type == DRAWABLE_WINDOW && @@ -731,11 +716,9 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, } /* - * If the pixmap is on shared memory, we can't - * know if the pixmap content is changed and - * so have to translate the operation in a put - * image operation. This can seriously affect - * the performance. + * If the pixmap is on shared memory, we can't know if the pixmap + * content is changed and so have to translate the operation in a + * put image operation. This can seriously affect the performance. */ if (pSrcDrawable -> type == DRAWABLE_PIXMAP && @@ -765,8 +748,8 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, fbGetImage(nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height, format, planeMask, data); /* - * If the source is a shared memory pixmap, - * put the image directly to the destination. + * If the source is a shared memory pixmap, put the image directly + * to the destination. */ nxagentPutImage(pDstDrawable, pGC, depth, dstx, dsty, @@ -781,10 +764,9 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, SAFE_free(data); /* - * If the source is a shared memory pixmap, the - * content of the framebuffer has been placed - * directly on the destination so we can skip - * the copy area operation. + * If the source is a shared memory pixmap, the content of the + * framebuffer has been placed directly on the destination so we + * can skip the copy area operation. */ skip = 1; @@ -816,8 +798,8 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, nxagentGC(pGC), srcx, srcy, width, height, dstx, dsty); /* - * The copy area restored the synchroni- - * zation status of destination drawable. + * The copy area restored the synchronization status of + * destination drawable. */ if (nxagentDrawableStatus(pDstDrawable) == NotSynchronized) @@ -867,8 +849,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, else if (pDstDrawable -> type == DRAWABLE_PIXMAP) { /* - * If we are here the source drawable - * must be a window. + * If we are here the source drawable must be a window. */ if (((WindowPtr) pSrcDrawable) -> viewable) @@ -885,8 +866,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, else { /* - * If we are here the source drawable - * must be a window. + * If we are here the source drawable must be a window. */ if (((WindowPtr) pSrcDrawable) -> viewable) @@ -947,11 +927,9 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, } /* - * If the pixmap is on shared memory, we can't - * know if the pixmap content is changed and - * so have to translate the operation in a put - * image operation. This can seriously affect - * the performance. + * If the pixmap is on shared memory, we can't know if the pixmap + * content is changed and so have to translate the operation in a + * put image operation. This can seriously affect the performance. */ if (pSrcDrawable -> type == DRAWABLE_PIXMAP && @@ -981,8 +959,8 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, fbGetImage(nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height, format, planeMask, data); /* - * If the source is a shared memory pixmap, - * put the image directly to the destination. + * If the source is a shared memory pixmap, put the image directly + * to the destination. */ nxagentPutImage(pDstDrawable, pGC, depth, dstx, dsty, @@ -997,10 +975,9 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, SAFE_free(data); /* - * If the source is a shared memory pixmap, the - * content of the framebuffer has been placed - * directly on the destination so we can skip - * the copy plane operation. + * If the source is a shared memory pixmap, the content of the + * framebuffer has been placed directly on the destination so we + * can skip the copy plane operation. */ skip = 1; @@ -1453,9 +1430,9 @@ void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, } /* - * The coordinate-mode must be CoordModePrevious - * to make better use of differential encoding of - * X_FillPoly request by the side of proxy. + * The coordinate-mode must be CoordModePrevious to make better use + * of differential encoding of X_FillPoly request by the side of + * proxy. */ if (mode == CoordModeOrigin) @@ -1465,17 +1442,15 @@ void nxagentFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, newPoints = malloc(nPoints * sizeof(xPoint)); /* - * The first point is always relative - * to the drawable's origin. + * The first point is always relative to the drawable's origin. */ newPoints[0].x = pPoints[0].x; newPoints[0].y = pPoints[0].y; /* - * If coordinate-mode is CoordModePrevious, - * the points following the first are rela- - * tive to the previous point. + * If coordinate-mode is CoordModePrevious, the points following + * the first are relative to the previous point. */ for (int i = 1; i < nPoints; i++) @@ -1569,12 +1544,11 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, } /* - * The PolyFillRect acts in two ways: if the GC - * has a corrupted tile, the operation propagates - * the corrupted region on the destination. In - * other cases, because the PolyFillRect will - * cover the destination, any corrupted region - * intersecting the target will be cleared. + * The PolyFillRect acts in two ways: if the GC has a corrupted + * tile, the operation propagates the corrupted region on the + * destination. In other cases, because the PolyFillRect will cover + * the destination, any corrupted region intersecting the target + * will be cleared. */ int inheritCorruptedRegion = 0; @@ -1622,10 +1596,9 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, if (inheritCorruptedRegion == 1) { /* - * The fill style should affect the cor- - * rupted region propagation: if the tile - * is not completely corrupted the region - * should be 'tiled' over the destination. + * The fill style should affect the corrupted region + * propagation: if the tile is not completely corrupted the + * region should be 'tiled' over the destination. */ nxagentMarkCorruptedRegion(pDrawable, rectRegion); @@ -1639,11 +1612,10 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, else { /* - * The stipple mask computation could cause - * an high fragmentation of the destination - * region. An analysis should be done to exa- - * mine the better solution (e.g.rdesktop - * uses stipples to draw texts). + * The stipple mask computation could cause an high + * fragmentation of the destination region. An analysis should + * be done to examine the better solution (e.g.rdesktop uses + * stipples to draw texts). */ #ifdef TEST @@ -1768,8 +1740,7 @@ int nxagentPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string) { /* - * While the session is suspended - * the font structure is NULL. + * While the session is suspended the font structure is NULL. */ if (nxagentFontStruct(pGC -> font) == NULL) @@ -1839,8 +1810,7 @@ int nxagentPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string) { /* - * While the session is suspended - * the font structure is NULL. + * While the session is suspended the font structure is NULL. */ if (nxagentFontStruct(pGC -> font) == NULL) -- cgit v1.2.3 From 9d1a12134b3c8d7fc5c1cfbc40698c1db383b390 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 22 Oct 2019 21:56:11 +0200 Subject: GCOps.c: fix format length specifiers --- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/GCOps.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 450a3c24f..ebb993229 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -409,12 +409,12 @@ FIXME: The popup could be synchronized with one single put image, RegionSubtract(pCorruptedRegion, pCorruptedRegion, pClipRegion); #ifdef DEBUG - fprintf(stderr, "nxagentDeferCopyArea: Recomputed clip region is [%d,%d,%d,%d][%ld].\n", + fprintf(stderr, "nxagentDeferCopyArea: Recomputed clip region is [%d,%d,%d,%d][%d].\n", pClipRegion -> extents.x1, pClipRegion -> extents.y1, pClipRegion -> extents.x2, pClipRegion -> extents.y2, RegionNumRects(pClipRegion)); - fprintf(stderr, "nxagentDeferCopyArea: Inherited corrupted region is [%d,%d,%d,%d][%ld].\n", + fprintf(stderr, "nxagentDeferCopyArea: Inherited corrupted region is [%d,%d,%d,%d][%d].\n", pCorruptedRegion -> extents.x1, pCorruptedRegion -> extents.y1, pCorruptedRegion -> extents.x2, pCorruptedRegion -> extents.y2, RegionNumRects(pCorruptedRegion)); -- cgit v1.2.3 From 41bc1de9868233f155b459a3be0f821cc39ff931 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 6 Sep 2019 04:05:37 +0200 Subject: GCOps.c: reformat comments --- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/GCOps.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index ebb993229..b4ddd5643 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -95,8 +95,7 @@ static int nxagentSaveGCTrap; RegionPtr nxagentBitBlitHelper(GC *pGC); /* - * The NX agent implementation of the - * X server's graphics functions. + * The NX agent implementation of the X server's graphics functions. */ void nxagentFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nSpans, @@ -170,7 +169,7 @@ void nxagentQueryBestSize(int class, unsigned short *pwidth, case StippleShape: width = *pwidth; if (!width) break; - /* Return the closes power of two not less than what they gave me */ + /* Return the closest power of two not less than what they gave me */ test = 0x80000000; /* Find the highest 1 bit in the width given */ while(!(test & width)) @@ -456,9 +455,8 @@ FIXME: The popup could be synchronized with one single put image, if (RegionNumRects(pClipRegion) == 1) { /* - * If the region to copy is formed by one - * rectangle, we change only the copy coor- - * dinates. + * If the region to copy is formed by one rectangle, we change + * only the copy coordinates. */ srcx = srcx + pClipRegion -> extents.x1 - dstx; -- cgit v1.2.3 From 8e66435a54f2d8c74249329503555e3e216b369b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 6 Sep 2019 04:08:21 +0200 Subject: GCOps.c: code simplification / scope improvements --- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/GCOps.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index b4ddd5643..5ac341990 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -296,7 +296,6 @@ FIXME: The popup could be synchronized with one single put image, #endif RegionRec corruptedRegion; - RegionInit(&corruptedRegion, NullBox, 1); RegionIntersect(&corruptedRegion, @@ -374,7 +373,6 @@ FIXME: The popup could be synchronized with one single put image, else { RegionRec tmpRegion; - RegionInit(&tmpRegion, NullBox, 1); #ifdef DEBUG @@ -540,14 +538,13 @@ FIXME: The popup could be synchronized with one single put image, { RegionPtr pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); - RegionRec corruptedRegion; - #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Source region [%d,%d,%d,%d].\n", pSrcRegion -> extents.x1, pSrcRegion -> extents.y1, pSrcRegion -> extents.x2, pSrcRegion -> extents.y2); #endif + RegionRec corruptedRegion; RegionInit(&corruptedRegion, NullBox, 1); RegionIntersect(&corruptedRegion, @@ -728,9 +725,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; - int leftPad = 0; - - int length = nxagentImageLength(width, height, format, leftPad, depth); + int length = nxagentImageLength(width, height, format, 0, depth); if ((data = malloc(length)) == NULL) { @@ -742,7 +737,6 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, } unsigned long planeMask = 0xffffffff; - fbGetImage(nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height, format, planeMask, data); /* @@ -751,7 +745,7 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, */ nxagentPutImage(pDstDrawable, pGC, depth, dstx, dsty, - width, height, leftPad, format, data); + width, height, 0, format, data); #ifdef TEST fprintf(stderr,"nxagentCopyArea: Realize Pixmap %p virtual %p x %d y %d w %d h %d\n", @@ -939,9 +933,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, unsigned int format = (depth == 1) ? XYPixmap : ZPixmap; - int leftPad = 0; - - int length = nxagentImageLength(width, height, format, leftPad, depth); + int length = nxagentImageLength(width, height, format, 0, depth); if ((data = malloc(length)) == NULL) { @@ -953,7 +945,6 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, } unsigned long planeMask = 0xffffffff; - fbGetImage(nxagentVirtualDrawable(pSrcDrawable), srcx, srcy, width, height, format, planeMask, data); /* @@ -962,7 +953,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, */ nxagentPutImage(pDstDrawable, pGC, depth, dstx, dsty, - width, height, leftPad, format, data); + width, height, 0, format, data); #ifdef TEST fprintf(stderr,"nxagentCopyPlane: Synchronize Pixmap %p virtual %p x %d y %d w %d h %d \n", -- cgit v1.2.3