From 56aaea90b4ee442b57f1370e3cafe0418deadc1d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 5 Sep 2019 19:17:53 +0200 Subject: Render.c: Code simplifications Save some lines... --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 261 ++++++++++------------------ 1 file changed, 89 insertions(+), 172 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 1690f18d2..4d56322e2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -211,8 +211,6 @@ nxagentCleanGlyphs(xGlyphInfo *gi, int bitsToClean; int widthInBytes; int height = gi -> height; - register int i; - int j; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: Found a Glyph with Depth %d, width %d, pad %d.\n", @@ -237,14 +235,14 @@ nxagentCleanGlyphs(xGlyphInfo *gi, if (ImageByteOrder(dpy) == LSBFirst) { - for (i = 3; i < bytesToClean; i += 4) + for (int i = 3; i < bytesToClean; i += 4) { images[i] = 0x00; } } else { - for (i = 0; i < bytesToClean; i += 4) + for (int i = 0; i < bytesToClean; i += 4) { images[i] = 0x00; } @@ -252,7 +250,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); - for (i = 0; i < bytesPerLine; i++) + for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } @@ -288,8 +286,9 @@ nxagentCleanGlyphs(xGlyphInfo *gi, ImageByteOrder(dpy), BitmapBitOrder(dpy)); #endif - for (i = 1; i <= height; i++) + for (int i = 1; i <= height; i++) { + int j; if (ImageByteOrder(dpy) == BitmapBitOrder(dpy)) { for (j = 1; j <= bytesToClean; j++) @@ -339,7 +338,7 @@ nxagentCleanGlyphs(xGlyphInfo *gi, #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); - for (i = 0; i < bytesPerLine; i++) + for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } @@ -375,22 +374,22 @@ nxagentCleanGlyphs(xGlyphInfo *gi, { while (height > 0) { - i = bytesToClean; + int count = bytesToClean; - while (i > 0) + while (count > 0) { - *(images + (bytesPerLine - i)) = 0; + *(images + (bytesPerLine - count)) = 0; #ifdef DEBUG fprintf(stderr, "nxagentCleanGlyphs: cleaned a byte.\n"); #endif - i--; + count--; } #ifdef DUMP fprintf(stderr, "nxagentCleanGlyphs: depth %d, bytesToClean %d, scanline: ", depth, bytesToClean); - for (i = 0; i < bytesPerLine; i++) + for (int i = 0; i < bytesPerLine; i++) { fprintf(stderr, "[%d]", images[i]); } @@ -564,9 +563,6 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) { XRenderPictureAttributes attributes; unsigned long valuemask=0; - XRenderPictFormat *pForm; - - Picture id; #ifdef DEBUG fprintf(stderr, "nxagentCreatePicture: Function called with picture at [%p] and mask [%ld].\n", @@ -721,7 +717,7 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) nxagentSetPictureRemoteValue(pPicture, component_alpha, attributes.component_alpha); } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (pPicture -> pFormat != NULL) { @@ -732,15 +728,14 @@ int nxagentCreatePicture(PicturePtr pPicture, Mask mask) if (pForm == NULL) { fprintf(stderr, "nxagentCreatePicture: WARNING! The requested format was not found.\n"); - return 0; } - id = XRenderCreatePicture(nxagentDisplay, - nxagentDrawable(pPicture -> pDrawable), - pForm, - valuemask, - &attributes); + Picture id = XRenderCreatePicture(nxagentDisplay, + nxagentDrawable(pPicture -> pDrawable), + pForm, + valuemask, + &attributes); #ifdef TEST fprintf(stderr, "nxagentCreatePicture: Created picture at [%p] with drawable at [%p].\n", @@ -1065,19 +1060,15 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) if (mask & CPSubwindowMode) { attributes.subwindow_mode = pPicture -> subWindowMode; - if (nxagentCheckPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode) == 0) { valuemask |= CPSubwindowMode; - nxagentSetPictureRemoteValue(pPicture, subwindow_mode, attributes.subwindow_mode); } } if (mask & CPClipMask) { - attributes.clip_mask = None; - /* * The nxagent doesn't know the remote id of * the picture's clip mask, so the clip_mask @@ -1086,10 +1077,10 @@ void nxagentChangePicture(PicturePtr pPicture, Mask mask) * 1. */ + attributes.clip_mask = None; if (nxagentPicturePriv(pPicture) -> lastServerValues.clip_mask != 0) { valuemask |= CPClipMask; - nxagentSetPictureRemoteValue(pPicture, clip_mask, 0); } } @@ -1188,15 +1179,12 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) { - RegionPtr pDstRegion; - if (pSrc == NULL || pDst == NULL) { return; } #ifdef DEBUG - if (pSrc && pSrc -> pDrawable != NULL) { fprintf(stderr, "nxagentComposite: Source Picture [%lu][%p] with drawable [%s%s][%p].\n", @@ -1225,12 +1213,11 @@ void nxagentComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pD pMask -> pDrawable -> type == DRAWABLE_PIXMAP ? "Pixmap" : "Window", (void *) pMask -> pDrawable); } - #endif if (NXAGENT_SHOULD_DEFER_COMPOSITE(pSrc, pMask, pDst)) { - pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, xDst, yDst, width, height); + RegionPtr pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, xDst, yDst, width, height); #ifdef TEST if ((pDstRegion) && (pDst && pDst->pDrawable)) { @@ -1343,23 +1330,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, XGlyphElt8 *elts, int sizeID, GlyphPtr *glyphsBase) { - XRenderPictFormat *pForm; - BoxRec glyphBox; XGlyphElt8 *elements; - #ifdef SPLIT_GLYPH_LISTS - - GlyphPtr glyph; - - int x; - int y; - int i; - int j; - - #endif /* #ifdef SPLIT_GLYPH_LISTS */ - if (pSrc == NULL || pDst == NULL) { return; @@ -1374,7 +1348,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } #endif - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -1421,10 +1395,8 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (pDst -> pDrawable -> type == DRAWABLE_WINDOW) { - RegionPtr pRegion; - - pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1, - glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1); + RegionPtr pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1, + glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1); if (RegionNil(pRegion) == 1) { @@ -1562,6 +1534,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, #endif #ifdef SPLIT_GLYPH_LISTS + GlyphPtr glyph; /* * We split glyphs lists here and recalculate @@ -1577,7 +1550,10 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, if (nlists > 1) { - for (j = 1; j < nlists; j++) + int x; + int y; + + for (int j = 1; j < nlists; j++) { x = elements -> xOff; y = elements -> yOff; @@ -1587,7 +1563,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, j, nlists, elements -> xOff, elements -> yOff); #endif - for (i = 0; i < elements -> nchars; i++) + for (int i = 0; i < elements -> nchars; i++) { glyph = *glyphsBase++; @@ -1619,7 +1595,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, { case 1: { - for (j = 0; j < nlists; j++) + for (int j = 0; j < nlists; j++) { XRenderCompositeText8(nxagentDisplay, op, @@ -1640,7 +1616,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } case 2: { - for (j = 0; j < nlists; j++) + for (int j = 0; j < nlists; j++) { XRenderCompositeText16(nxagentDisplay, op, @@ -1661,7 +1637,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, } case 4: { - for (j = 0; j < nlists; j++) + for (int j = 0; j < nlists; j++) { XRenderCompositeText32(nxagentDisplay, op, @@ -1751,19 +1727,15 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, fprintf(stderr, "nxagentGlyphs: WARNING! Invalid size id [%d].\n", sizeID); #endif - break; } } - #endif /* #ifdef SPLIT_GLYPH_LISTS */ } void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, int nRect, xRectangle *rects) { - RegionPtr rectRegion; - if (pDst == NULL) { return; @@ -1788,7 +1760,7 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, (op == PictOpSrc || (op == PictOpOver && color -> alpha == 0xffff))) { - rectRegion = RegionFromRects(nRect, rects, CT_REGION); + RegionPtr rectRegion = RegionFromRects(nRect, rects, CT_REGION); if (pDst -> clientClipType != CT_NONE) { @@ -1834,12 +1806,8 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid *traps) { - XRenderPictFormat *pForm; - XTrapezoid *current = (XTrapezoid *) traps; - RegionPtr pDstRegion; - int remaining = ntrap; #ifdef TEST @@ -1853,7 +1821,7 @@ void nxagentTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, return; } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -1924,11 +1892,11 @@ FIXME: Is this useful or just a waste of bandwidth? if (NXAGENT_SHOULD_DEFER_TRAPEZOIDS(pDst -> pDrawable)) { - pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, - nxagentTrapezoidExtents -> x1, - nxagentTrapezoidExtents -> y1, - nxagentTrapezoidExtents -> x2 - nxagentTrapezoidExtents -> x1, - nxagentTrapezoidExtents -> y2 - nxagentTrapezoidExtents -> y1); + RegionPtr pDstRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, + nxagentTrapezoidExtents -> x1, + nxagentTrapezoidExtents -> y1, + nxagentTrapezoidExtents -> x2 - nxagentTrapezoidExtents -> x1, + nxagentTrapezoidExtents -> y2 - nxagentTrapezoidExtents -> y1); #ifdef TEST if (pDst && pDst->pDrawable) { @@ -1973,14 +1941,14 @@ FIXME: Is this useful or just a waste of bandwidth? nxagentSynchronizeBox(pDst -> pDrawable, nxagentTrapezoidExtents, NEVER_BREAK); } - XRenderCompositeTrapezoids(nxagentDisplay, - op, - nxagentPicturePriv(pSrc) -> picture, - nxagentPicturePriv(pDst) -> picture, - pForm, - xSrc, - ySrc, - (XTrapezoid *) current,remaining); + XRenderCompositeTrapezoids(nxagentDisplay, + op, + nxagentPicturePriv(pSrc) -> picture, + nxagentPicturePriv(pDst) -> picture, + pForm, + xSrc, + ySrc, + (XTrapezoid *) current,remaining); #endif @@ -1994,8 +1962,6 @@ void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int ntri, xTriangle *tris) { - XRenderPictFormat *pForm; - #ifdef DEBUG fprintf(stderr, "nxagentTriangles: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", (void *) pSrc, (void *) pDst, xSrc, ySrc, ntri); @@ -2006,7 +1972,7 @@ void nxagentTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, return; } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -2065,8 +2031,6 @@ void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points) { - XRenderPictFormat *pForm; - #ifdef DEBUG fprintf(stderr, "nxagentTriStrip: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", (void *) pSrc, (void *) pDst, xSrc, ySrc, npoint); @@ -2077,7 +2041,7 @@ void nxagentTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst, return; } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -2136,8 +2100,6 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int npoint, xPointFixed *points) { - XRenderPictFormat *pForm; - #ifdef DEBUG fprintf(stderr, "nxagentTriFan: Source [%p] Destination [%p] Coordinates [%d,%d] Elements [%d].\n", (void *) pSrc, (void *) pDst, xSrc, ySrc, npoint); @@ -2148,7 +2110,7 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, return; } - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (maskFormat != NULL) { @@ -2205,31 +2167,27 @@ void nxagentTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst, void nxagentQueryFormats(void) { - XRenderInfo *xri; - XExtDisplayInfo *info = NULL; - XRenderPictFormat *pformat=NULL; - - int i; - #ifdef DEBUG fprintf(stderr, "nxagentQueryFormats.\n"); #endif if (XRenderQueryFormats(nxagentDisplay)) { + int i; + #ifdef DEBUG XSync(nxagentDisplay, 0); #endif - info = (XExtDisplayInfo *) XRenderFindDisplay(nxagentDisplay); + XExtDisplayInfo *info = (XExtDisplayInfo *) XRenderFindDisplay(nxagentDisplay); #ifdef DEBUG XSync(nxagentDisplay, 0); #endif - xri = (XRenderInfo *) info -> data; + XRenderInfo *xri = (XRenderInfo *) info -> data; - pformat = xri -> format; + XRenderPictFormat *pformat = xri -> format; for (i = 0; i < xri -> nformat; i++) { @@ -2269,13 +2227,11 @@ void nxagentQueryFormats(void) void nxagentCreateGlyphSet(GlyphSetPtr pGly) { - XRenderPictFormat *pForm; - #ifdef DEBUG fprintf(stderr, "nxagentCreateGlyphSet: Glyphset at [%p].\n", (void *) pGly); #endif - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (pGly -> format != NULL) { @@ -2328,13 +2284,6 @@ void nxagentFreeGlyphSet(GlyphSetPtr glyphSet) void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, int nglyphs, CARD8 *images, int sizeImages) { - GlyphRefPtr gr; - Glyph *tempGids; - - int i; - - CARD8 *normalizedImages; - #ifdef DEBUG fprintf(stderr, "nxagentAddGlyphs: Glyphset at [%p]. Number of glyphs [%d].\n", (void *) glyphSet, nglyphs); @@ -2356,12 +2305,12 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, * as synchronized. */ - tempGids = gids; - - for (i = 0; i < nglyphs; i++) + for (int i = 0; i < nglyphs; i++) { - if ((gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0)) && - gr -> glyph != DeletedGlyph) + Glyph *tempGids = gids; + GlyphRefPtr gr = FindGlyphRef(&glyphSet -> hash, *tempGids, 0, 0); + + if (gr && gr -> glyph != DeletedGlyph) { #ifdef DEBUG fprintf(stderr, "nxagentAddGlyphs: Added Glyph [%p][%ld] to glyphset [%p].\n", @@ -2374,7 +2323,7 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, tempGids++; } - normalizedImages = NULL; + CARD8 *normalizedImages = NULL; if (sizeImages > 0) { @@ -2428,11 +2377,8 @@ void nxagentAddGlyphs(GlyphSetPtr glyphSet, Glyph *gids, xGlyphInfo *gi, void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph) { GlyphRefPtr gr; - CARD32 *tempGids; Glyph gid; - int i; - if (glyphSet -> remoteID == 0) { #ifdef TEST @@ -2450,9 +2396,9 @@ void nxagentFreeGlyphs(GlyphSetPtr glyphSet, CARD32 *gids, int nglyph) * they can be freed. */ - tempGids = gids; + CARD32 *tempGids = gids; - for (i = 0; i < nglyph; i++) + for (int i = 0; i < nglyph; i++) { gid = (Glyph)*tempGids; @@ -2587,10 +2533,6 @@ static void nxagentPrintFormat(XRenderPictFormat *pFormat) Bool nxagentFillGlyphSet(GlyphSetPtr pGly) { - GlyphPtr glyph; - - int i; - #ifdef DEBUG fprintf(stderr, "nxagentFillGlyphSet: GlyphSet at [%p] Refcount [%ld] Glyphs [%ld] " "Format [%p] FDepth [%d] RemoteID [%ld].\n", (void *) pGly, pGly -> refcnt, @@ -2604,9 +2546,9 @@ Bool nxagentFillGlyphSet(GlyphSetPtr pGly) * corrupted the glyphs for each glyphset. */ - for (i = 0; i < pGly -> hash.hashSet -> size; i++) + for (int i = 0; i < pGly -> hash.hashSet -> size; i++) { - glyph = pGly -> hash.table[i].glyph; + GlyphPtr glyph = pGly -> hash.table[i].glyph; if (glyph && (glyph != DeletedGlyph)) { @@ -2621,12 +2563,11 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2) { GlyphSetPtr pGly = (GlyphSetPtr) p0; - XRenderPictFormat *pForm = NULL; - - int i; - if (nxagentReconnectTrap == 0) { + int i; + XRenderPictFormat *pForm = NULL; + #ifdef DEBUG fprintf(stderr, "nxagentReconnectGlyphSet: GlyphSet at [%p].\n", (void *) pGly); #endif @@ -2667,7 +2608,6 @@ void nxagentReconnectGlyphSet(void* p0, XID x1, void *p2) Bool nxagentReconnectAllGlyphSet(void *p) { Bool success = True; - int i; nxagentQueryFormats(); @@ -2675,7 +2615,7 @@ Bool nxagentReconnectAllGlyphSet(void *p) fprintf(stderr, "nxagentReconnectAllGlyphSet\n"); #endif - for (i = 0; (i < MAXCLIENTS) && (success); i++) + for (int i = 0; (i < MAXCLIENTS) && (success); i++) { if (clients[i]) { @@ -2693,7 +2633,6 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) unsigned long mask = 0; XRenderPictureAttributes attributes; - XRenderPictFormat *pForm; #ifdef TEST fprintf(stderr, "nxagentReconnectPicture: Called with bool [%d] and picture at [%p].\n", @@ -2716,9 +2655,8 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) if (pPicture -> repeat) { - mask |= CPRepeat; - attributes.repeat = (Bool) pPicture -> repeat; + mask |= CPRepeat; } if (pPicture -> alphaMap) @@ -2736,38 +2674,31 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) attributes.alpha_map = nxagentPicture(pPicture -> alphaMap); attributes.alpha_x_origin = pPicture -> alphaOrigin.x; attributes.alpha_y_origin = pPicture -> alphaOrigin.y; - mask |= (CPAlphaMap | CPAlphaXOrigin | CPAlphaYOrigin); } if (pPicture -> graphicsExposures) { attributes.graphics_exposures = pPicture -> graphicsExposures; - mask |= CPGraphicsExposure; } attributes.subwindow_mode = pPicture -> subWindowMode; - mask |= CPSubwindowMode; attributes.poly_edge = pPicture -> polyEdge; - mask |= CPPolyEdge; attributes.poly_mode = pPicture -> polyMode; - mask |= CPPolyMode; attributes.dither = pPicture -> dither; - mask |= CPDither; attributes.component_alpha = pPicture -> componentAlpha; - mask |= CPComponentAlpha; - pForm = NULL; + XRenderPictFormat *pForm = NULL; if (pPicture -> pFormat) { @@ -2827,14 +2758,13 @@ void nxagentReconnectPicture(void * p0, XID x1, void *p2) Bool nxagentReconnectAllPicture(void *p) { - int i; - Bool r; + Bool r = True; #ifdef TEST fprintf(stderr, "nxagentReconnectAllPicture: Going to recreate all pictures.\n"); #endif - for (i = 0, r = True; i < MAXCLIENTS; i++) + for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { @@ -2883,14 +2813,13 @@ void nxagentDisconnectPicture(void * p0, XID x1, void* p2) Bool nxagentDisconnectAllPicture(void) { - int i; - Bool r; + Bool r = True; #ifdef DEBUG fprintf(stderr, "nxagentDisconnectAllPicture.\n"); #endif - for (i = 0, r = True; i < MAXCLIENTS; i++) + for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { @@ -2913,8 +2842,6 @@ Bool nxagentDisconnectAllPicture(void) void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) { - Picture id; - if (nxagentRenderEnable == False) { return; @@ -2939,7 +2866,7 @@ void nxagentRenderCreateSolidFill(PicturePtr pPicture, xRenderColor *color) memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); - id = XRenderCreateSolidFill(nxagentDisplay, (XRenderColor *) color); + Picture id = XRenderCreateSolidFill(nxagentDisplay, (XRenderColor *) color); #ifdef DEBUG XSync(nxagentDisplay, 0); @@ -2957,10 +2884,6 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, xFixed *stops, xRenderColor *colors) { - Picture id; - - XLinearGradient linearGradient; - if (nxagentRenderEnable == False) { return; @@ -3000,14 +2923,16 @@ void nxagentRenderCreateLinearGradient(PicturePtr pPicture, xPointFixed *p1, memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); + XLinearGradient linearGradient; + linearGradient.p1.x = (XFixed) p1 -> x; linearGradient.p1.y = (XFixed) p1 -> y; linearGradient.p2.x = (XFixed) p2 -> x; linearGradient.p2.y = (XFixed) p2 -> y; - id = XRenderCreateLinearGradient(nxagentDisplay, &linearGradient, - (XFixed *) stops, - (XRenderColor *) colors, nStops); + Picture id = XRenderCreateLinearGradient(nxagentDisplay, &linearGradient, + (XFixed *) stops, + (XRenderColor *) colors, nStops); #ifdef DEBUG XSync(nxagentDisplay, 0); @@ -3028,17 +2953,12 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, xFixed *stops, xRenderColor *colors) { - Picture id; - - XRadialGradient radialGradient; - if (nxagentRenderEnable == False) { return; } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateRadialGradient: Got called.\n"); if (pPicture == NULL) @@ -3065,12 +2985,13 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, { fprintf(stderr, "nxagentRenderCreateRadialGradient: WARNING! colors pointer is NULL.\n"); } - #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); + XRadialGradient radialGradient; + radialGradient.inner.x = (XFixed) inner -> x; radialGradient.inner.y = (XFixed) inner -> y; radialGradient.inner.radius = (XFixed) innerRadius; @@ -3078,7 +2999,7 @@ void nxagentRenderCreateRadialGradient(PicturePtr pPicture, xPointFixed *inner, radialGradient.outer.y = (XFixed) outer -> y; radialGradient.outer.radius = (XFixed) outerRadius; - id = XRenderCreateRadialGradient(nxagentDisplay, &radialGradient, + Picture id = XRenderCreateRadialGradient(nxagentDisplay, &radialGradient, (XFixed *) stops, (XRenderColor *) colors, nStops); @@ -3099,17 +3020,12 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture, xFixed *stops, xRenderColor *colors) { - Picture id; - - XConicalGradient conicalGradient; - if (nxagentRenderEnable == False) { return; } #ifdef DEBUG - fprintf(stderr, "nxagentRenderCreateConicalGradient: Got called.\n"); if (pPicture == NULL) @@ -3131,19 +3047,20 @@ void nxagentRenderCreateConicalGradient(PicturePtr pPicture, { fprintf(stderr, "nxagentRenderCreateConicalGradient: WARNING! colors pointer is NULL.\n"); } - #endif /* #ifdef DEBUG */ memset(&(nxagentPicturePriv(pPicture) -> lastServerValues), 0, sizeof(XRenderPictureAttributes_)); + XConicalGradient conicalGradient; + conicalGradient.center.x = (XFixed) center -> x; conicalGradient.center.y = (XFixed) center -> y; conicalGradient.angle = (XFixed) angle; - id = XRenderCreateConicalGradient(nxagentDisplay, &conicalGradient, - (XFixed *) stops, - (XRenderColor *) colors, nStops); + Picture id = XRenderCreateConicalGradient(nxagentDisplay, &conicalGradient, + (XFixed *) stops, + (XRenderColor *) colors, nStops); #ifdef DEBUG XSync(nxagentDisplay, 0); -- cgit v1.2.3