diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-10-04 16:12:17 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-10-04 16:15:04 +0100 |
commit | 20afd7263f65f29128fbbdbd5894a49594cda669 (patch) | |
tree | 902e1aff394355aa9fd4d63a8d8fc34040d6899f | |
parent | 22557b88d3c0bb8f883db7d0d0bf85f1255c65c9 (diff) |
sna: Tidy up FillRectangles intersection with complex clip
Lesson 1: do not accidentally overwrite the loop count inside the loop.
Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70137
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_composite.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c index c6d6d2d3..a36bdf20 100644 --- a/src/sna/sna_composite.c +++ b/src/sna/sna_composite.c @@ -766,7 +766,7 @@ sna_composite_rectangles(CARD8 op, pixman_region16_t region; pixman_box16_t stack_boxes[64], *boxes = stack_boxes, *b; int16_t dst_x, dst_y; - int i, num_boxes, error; + int i, num_boxes; unsigned hint; DBG(("%s(op=%d, %08x x %d [(%d, %d)x(%d, %d) ...])\n", @@ -1012,15 +1012,20 @@ sna_composite_rectangles(CARD8 op, region.data = NULL; if (pixman_region_intersect(&tmp, &tmp, dst->pCompositeClip)) { - pixman_region_translate(&tmp, dst_x, dst_y); - b = pixman_region_rectangles(®ion, &num_boxes); - if (num_boxes) - error = !sna->render.fill_boxes(sna, op, dst->format, color, - pixmap, bo, b, num_boxes); + int n = 0; + + b = pixman_region_rectangles(&tmp, &n); + if (n) { + if (dst_x | dst_y) + pixman_region_translate(&tmp, dst_x, dst_y); + + n = !sna->render.fill_boxes(sna, op, dst->format, color, + pixmap, bo, b, n); + } pixman_region_fini(&tmp); - if (error) { + if (n) { DBG(("%s: fallback - acceleration failed\n", __FUNCTION__)); goto fallback; } @@ -1121,6 +1126,7 @@ fallback: } while (--nbox); } else { PicturePtr src; + int error; fallback_composite: DBG(("%s: fallback -- fbComposite()\n", __FUNCTION__)); |