From d3d6c5f4d05e0ca5b566e19657e0fe2b3898482a Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Sat, 1 Jul 2006 11:10:18 -0700 Subject: [PATCH] Bug #7381: Coordinates get wrapped in accelerated line drawing on pixmap XAAPolylinesWideSolid was adding the drawable origin onto each element in the pPts array. Since the values got stored back into the pPts array, they got truncated to 16 bits, causing the overflow I saw. This patch avoids storing the coords back into the pPts array (and actually reduces the size of the code too :). Now the 32-bit sum of coords + origin doesn't get truncated to 16 bits, and the problem is solved. --- hw/xfree86/xaa/xaaWideLine.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/hw/xfree86/xaa/xaaWideLine.c b/hw/xfree86/xaa/xaaWideLine.c index fbec29e7d..369088e32 100644 --- a/hw/xfree86/xaa/xaaWideLine.c +++ b/hw/xfree86/xaa/xaaWideLine.c @@ -818,20 +818,6 @@ XAAPolylinesWideSolid ( return; } - if (mode == CoordModePrevious) { - pPts->x += xorg; - pPts->y += yorg; - } else if(xorg | yorg) { - register int n = npt; - register DDXPointPtr pts = pPts; - - while(n--) { - pts->x += xorg; - pts->y += yorg; - pts++; - } - } - x2 = pPts->x; y2 = pPts->y; if (npt > 1) { @@ -869,6 +855,8 @@ XAAPolylinesWideSolid ( infoRec->ClipBox->x2 - 1, infoRec->ClipBox->y2 - 1); } + x2 += xorg; + y2 += yorg; while (--npt) { x1 = x2; y1 = y2; @@ -878,6 +866,9 @@ XAAPolylinesWideSolid ( if (mode == CoordModePrevious) { x2 += x1; y2 += y1; + } else { + x2 += xorg; + y2 += yorg; } if ((x1 != x2) || (y1 != y2)) { somethingDrawn = TRUE;