From 92af1b26ff2460aa6cb4a520649d1f9940a9519c Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 8 Sep 2025 16:22:00 +0200 Subject: [PATCH] render: consolidate byte-swapping in ProcRenderTriStrip() No need for extra functions and call tables for the few trivial lines. Signed-off-by: Enrico Weigelt, metux IT consult --- render/render.c | 48 +++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/render/render.c b/render/render.c index e5a2778ff4..d4221bdf72 100644 --- a/render/render.c +++ b/render/render.c @@ -98,7 +98,6 @@ static int ProcRenderCreateConicalGradient(ClientPtr pClient); static int ProcRenderDispatch(ClientPtr pClient); -static int SProcRenderTriStrip(ClientPtr pClient); static int SProcRenderTriFan(ClientPtr pClient); static int SProcRenderCompositeGlyphs(ClientPtr pClient); static int SProcRenderFillRectangles(ClientPtr pClient); @@ -163,7 +162,7 @@ int (*SProcRenderVector[RenderNumberRequests]) (ClientPtr) = { _not_implemented, /* SProcRenderScale */ ProcRenderTrapezoids, ProcRenderTriangles, - SProcRenderTriStrip, + ProcRenderTriStrip, SProcRenderTriFan, _not_implemented, /* SProcRenderColorTrapezoids */ _not_implemented, /* SProcRenderColorTriangles */ @@ -716,15 +715,12 @@ SingleRenderTriangles(ClientPtr client, xRenderTrianglesReq *stuff) } static int -SingleRenderTriStrip(ClientPtr client) +SingleRenderTriStrip(ClientPtr client, xRenderTriStripReq *stuff) { int rc, npoints; PicturePtr pSrc, pDst; PictFormatPtr pFormat; - REQUEST(xRenderTrianglesReq); - - REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); if (!PictOpValid(stuff->op)) { client->errorValue = stuff->op; return BadValue; @@ -1957,21 +1953,6 @@ ProcRenderDispatch(ClientPtr client) return BadRequest; } -static int _X_COLD -SProcRenderTriStrip(ClientPtr client) -{ - REQUEST(xRenderTriStripReq); - - REQUEST_AT_LEAST_SIZE(xRenderTriStripReq); - swapl(&stuff->src); - swapl(&stuff->dst); - swapl(&stuff->maskFormat); - swaps(&stuff->xSrc); - swaps(&stuff->ySrc); - SwapRestL(stuff); - return ProcRenderTriStrip(client); -} - static int _X_COLD SProcRenderTriFan(ClientPtr client) { @@ -2647,17 +2628,14 @@ PanoramiXRenderTriangles(ClientPtr client, xRenderTrianglesReq *stuff) } static int -PanoramiXRenderTriStrip(ClientPtr client) +PanoramiXRenderTriStrip(ClientPtr client, xRenderTriStripReq *stuff) { PanoramiXRes *src, *dst; int result = Success; - REQUEST(xRenderTriStripReq); char *extra; int extra_len; - REQUEST_AT_LEAST_SIZE(xRenderTriStripReq); - VERIFY_XIN_PICTURE(src, stuff->src, client, DixReadAccess); VERIFY_XIN_PICTURE(dst, stuff->dst, client, DixWriteAccess); @@ -2687,7 +2665,7 @@ PanoramiXRenderTriStrip(ClientPtr client) stuff->src = src->info[walkScreenIdx].id; stuff->dst = dst->info[walkScreenIdx].id; - result = SingleRenderTriStrip(client); + result = SingleRenderTriStrip(client, stuff); if (result != Success) break; @@ -3092,11 +3070,23 @@ ProcRenderTriangles(ClientPtr client) static int ProcRenderTriStrip(ClientPtr client) { + REQUEST(xRenderTriStripReq); + REQUEST_AT_LEAST_SIZE(xRenderTriStripReq); + + if (client->swapped) { + swapl(&stuff->src); + swapl(&stuff->dst); + swapl(&stuff->maskFormat); + swaps(&stuff->xSrc); + swaps(&stuff->ySrc); + SwapRestL(stuff); + } + #ifdef XINERAMA - return (usePanoramiX ? PanoramiXRenderTriStrip(client) - : SingleRenderTriStrip(client)); + return (usePanoramiX ? PanoramiXRenderTriStrip(client, stuff) + : SingleRenderTriStrip(client, stuff)); #else - return SingleRenderTriStrip(client); + return SingleRenderTriStrip(client, stuff)); #endif }