From 6802ee00e52515ca886b956f6c0a0e27d708fb31 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 19 Mar 2014 10:25:05 +0000 Subject: sna: Assert after applying clipping that the draw rectangle is wholly contained Otherwise we ignore the purpose of applying the clip! Signed-off-by: Chris Wilson --- src/sna/sna_accel.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 4f08e99d..a192d060 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -12149,7 +12149,7 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable, if (clip.data == NULL) { const BoxRec *box = &clip.extents; - DBG(("%s: single clip box [(%d, %d), (%d, %d)]", + DBG(("%s: single clip box [(%d, %d), (%d, %d)]\n", __FUNCTION__, box->x1, box->y1, box->x2, box->y2)); while (n--) { BoxRec r; @@ -12162,10 +12162,6 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable, DBG(("%s: rectangle [(%d, %d), (%d, %d)]\n", __FUNCTION__, r.x1, r.y1, r.x2, r.y2)); - assert(r.x1 + dx >= 0); - assert(r.y1 + dy >= 0); - assert(r.x2 + dx <= pixmap->drawable.width); - assert(r.y2 + dy <= pixmap->drawable.height); if (box_intersect(&r, box)) { int height = r.y2 - r.y1; @@ -12174,6 +12170,11 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable, if (tile_y < 0) tile_y += tile_height; + assert(r.x1 + dx >= 0); + assert(r.y1 + dy >= 0); + assert(r.x2 + dx <= pixmap->drawable.width); + assert(r.y2 + dy <= pixmap->drawable.height); + while (height) { int width = r.x2 - r.x1; int dst_x = r.x1, tile_x; @@ -12234,14 +12235,15 @@ sna_poly_fill_rect_tiled_blt(DrawablePtr drawable, region.extents.y1, region.extents.x2, region.extents.y2)); + + region.data = NULL; + RegionIntersect(®ion, ®ion, &clip); + assert(region.extents.x1 + dx >= 0); assert(region.extents.y1 + dy >= 0); assert(region.extents.x2 + dx <= pixmap->drawable.width); assert(region.extents.y2 + dy <= pixmap->drawable.height); - region.data = NULL; - RegionIntersect(®ion, ®ion, &clip); - nbox = RegionNumRects(®ion); box = RegionRects(®ion); DBG(("%s: split into %d boxes after clipping\n", __FUNCTION__, nbox)); -- cgit v1.2.3