From bc4323558bebd53e474fbc5404e1c41ab16d02e6 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 31 May 2012 21:19:26 +0100 Subject: [PATCH] sna: Handle negative values when computing the stipple modulus Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 7f3af056..d7750c79 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -9772,6 +9772,8 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna, for (y1 = box->y1; y1 < box->y2; y1 = y2) { int oy = (y1 - origin->y) % gc->stipple->drawable.height; + if (oy < 0) + oy += gc->stipple->drawable.height; y2 = box->y2; if (y2 - y1 > gc->stipple->drawable.height - oy) @@ -9783,6 +9785,8 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna, x2 = box->x2; ox = (x1 - origin->x) % gc->stipple->drawable.width; + if (ox < 0) + ox += gc->stipple->drawable.width; bx1 = ox & ~7; bx2 = ox + (x2 - x1); if (bx2 > gc->stipple->drawable.width) {