From 2e9ef86fd1a03d6f0c54cf05022031e697c6ce81 Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 12 Sep 2014 09:33:05 +0100 Subject: vivante: fix PolyPoint() CoordModePrevious The PolyPoint() CoordModePrevious implementation was incorrect - it only accounted for the previous point's relative position, not its absolute position, leading to rendering errors. Signed-off-by: Russell King --- src/vivante_accel.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/vivante_accel.c b/src/vivante_accel.c index f1ff49c..2f5d101 100644 --- a/src/vivante_accel.c +++ b/src/vivante_accel.c @@ -789,15 +789,25 @@ Bool vivante_accel_PolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, if (!pBox) return FALSE; - for (i = 0; i < npt; i++) { - pBox[i].x1 = ppt[i].x + pDrawable->x; - pBox[i].y1 = ppt[i].y + pDrawable->y; - if (i > 0 && mode == CoordModePrevious) { - pBox[i].x1 += ppt[i - 1].x; - pBox[i].y1 += ppt[i - 1].y; + if (mode == CoordModePrevious) { + int x, y; + + x = y = 0; + for (i = 0; i < npt; i++) { + x += ppt[i].x; + y += ppt[i].y; + pBox[i].x1 = x + pDrawable->x; + pBox[i].y1 = y + pDrawable->y; + pBox[i].x2 = pBox[i].x1 + 1; + pBox[i].y2 = pBox[i].y1 + 1; + } + } else { + for (i = 0; i < npt; i++) { + pBox[i].x1 = ppt[i].x + pDrawable->x; + pBox[i].y1 = ppt[i].y + pDrawable->y; + pBox[i].x2 = pBox[i].x1 + 1; + pBox[i].y2 = pBox[i].y1 + 1; } - pBox[i].x2 = pBox[i].x1 + 1; - pBox[i].y2 = pBox[i].y1 + 1; } /* Convert the boxes to a region */ -- cgit v1.2.3