summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-24 15:50:02 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-24 18:54:07 +0000
commit09bddddaf94b848f417e1c9449cfe4b21d2554dd (patch)
treee4a068e80d7dbb1484edd1aee10f5e471f8b6a05
parentf3b11ebc28114062581c39089781114323946654 (diff)
sna: handle negative modulus for tiled blits
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 70b712a4..0cf7faca 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -8330,17 +8330,22 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
do {
xRectangle r = *rect++;
int16_t tile_y = (r.y - origin->y) % tile_height;
+ if (tile_y < 0)
+ tile_y += tile_height;
r.y += dy;
do {
int16_t width = r.width;
- int16_t x = r.x + dx;
- int16_t tile_x = (r.x - origin->x) % tile_width;
+ int16_t x = r.x + dx, tile_x;
int16_t h = tile_height - tile_y;
if (h > r.height)
h = r.height;
r.height -= h;
+ tile_x = (r.x - origin->x) % tile_width;
+ if (tile_x < 0)
+ tile_x += tile_width;
+
do {
int16_t w = tile_width - tile_x;
if (w > width)
@@ -8382,15 +8387,21 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
int height = r.y2 - r.y1;
int dst_y = r.y1;
int tile_y = (r.y1 - drawable->y - origin->y) % tile_height;
+ if (tile_y < 0)
+ tile_y += tile_height;
+
while (height) {
int width = r.x2 - r.x1;
- int dst_x = r.x1;
- int tile_x = (r.x1 - drawable->x - origin->x) % tile_width;
+ int dst_x = r.x1, tile_x;
int h = tile_height - tile_y;
if (h > height)
h = height;
height -= h;
+ tile_x = (r.x1 - drawable->x - origin->x) % tile_width;
+ if (tile_x < 0)
+ tile_x += tile_width;
+
while (width > 0) {
int w = tile_width - tile_x;
if (w > width)
@@ -8442,15 +8453,21 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable,
int height = box->y2 - box->y1;
int dst_y = box->y1;
int tile_y = (box->y1 - drawable->y - origin->y) % tile_height;
+ if (tile_y < 0)
+ tile_y += tile_height;
+
while (height) {
int width = box->x2 - box->x1;
- int dst_x = box->x1;
- int tile_x = (box->x1 - drawable->x - origin->x) % tile_width;
+ int dst_x = box->x1, tile_x;
int h = tile_height - tile_y;
if (h > height)
h = height;
height -= h;
+ tile_x = (box->x1 - drawable->x - origin->x) % tile_width;
+ if (tile_x < 0)
+ tile_x += tile_width;
+
while (width > 0) {
int w = tile_width - tile_x;
if (w > width)