[PATCH xserver 2/2] Eliminate coordinate mode in PolyPoint, PolyLines and FillPolygon ops
Adam Jackson
ajax at nwnk.net
Fri Sep 23 12:24:47 UTC 2016
On Fri, 2016-09-23 at 01:15 +0300, Keith Packard wrote:
> +static void
> +FixCoordModePrevious(int npt, xPoint *ppt)
> +{
> + int x, y;
> +
> + x = ppt->x;
> + y = ppt->y;
> + npt--;
> + while (npt--) {
> + ppt++;
> + x = (ppt->x += x);
> + y = (ppt->y += y);
> + }
> +}
You want to make this non-static, so in the xinerama case you can do
this translation once at the top level.
> @@ -1785,9 +1800,12 @@ ProcPolyPoint(ClientPtr client)
> }
> VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
> npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq));
> - if (npoint)
> - (*pGC->ops->PolyPoint) (pDraw, pGC, stuff->coordMode, npoint,
> + if (npoint) {
> + if (stuff->coordMode == CoordModePrevious)
> + FixCoordModePrevious(npoint, (xPoint *) &stuff[1]);
> + (*pGC->ops->PolyPoint) (pDraw, pGC, npoint,
> (xPoint *) &stuff[1]);
> + }
> return Success;
> }
You're not correcting stuff->coordMode in place, which means under
xinerama you'll mutate geometry once per screen, which ain't right.
- ajax
More information about the xorg-devel
mailing list