From 75b9dc907b332d64d074083cae0c6b099960f09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 27 Sep 2007 13:08:41 +0200 Subject: [PATCH] EXA: Make sure tile offsets passed to drivers are never negative. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Björn Steinbrink for pointing out the problem on IRC. (cherry picked from commit 006f6525057970a74382132237b2131286ad147c with modifications.) --- exa/exa_accel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exa/exa_accel.c b/exa/exa_accel.c index acc5dbee3..aed4e421c 100644 --- a/exa/exa_accel.c +++ b/exa/exa_accel.c @@ -1187,7 +1187,8 @@ exaFillRegionTiled (DrawablePtr pDrawable, int dstY = pBox->y1; int tileY; - tileY = (dstY - pDrawable->y - pPatOrg->y) % tileHeight; + modulus(dstY - pDrawable->y - pPatOrg->y, tileHeight, tileY); + while (height > 0) { int width = pBox->x2 - pBox->x1; int dstX = pBox->x1; @@ -1198,7 +1199,8 @@ exaFillRegionTiled (DrawablePtr pDrawable, h = height; height -= h; - tileX = (dstX - pDrawable->x - pPatOrg->x) % tileWidth; + modulus(dstX - pDrawable->x - pPatOrg->x, tileWidth, tileX); + while (width > 0) { int w = tileWidth - tileX; if (w > width)