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>
This commit is contained in:
Chris Wilson 2013-10-04 16:12:17 +01:00
parent 22557b88d3
commit 20afd7263f
1 changed files with 13 additions and 7 deletions

View File

@ -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(&region, &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__));