diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-05 21:05:34 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-05 21:47:14 +0000 |
commit | b69c9dfae128ed69a397a066b8fbe62012742bf1 (patch) | |
tree | 3f555993ce70616d712ae14bca50335ce6546698 /src/sna/sna_composite.c | |
parent | f4846168a60feca7437f0039612ba9986c5f8d77 (diff) |
sna/composite: Skip clipping the rectangle region against the singular clip
As we will already have taken it into account when constructing the
region from the rectangles.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_composite.c')
-rw-r--r-- | src/sna/sna_composite.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c index 55a496e6..7f1d0960 100644 --- a/src/sna/sna_composite.c +++ b/src/sna/sna_composite.c @@ -563,7 +563,7 @@ _pixman_region_init_clipped_rectangles(pixman_region16_t *region, unsigned int num_rects, xRectangle *rects, int tx, int ty, - int maxx, int maxy) + BoxPtr extents) { pixman_box16_t stack_boxes[64], *boxes = stack_boxes; pixman_bool_t ret; @@ -576,25 +576,21 @@ _pixman_region_init_clipped_rectangles(pixman_region16_t *region, } for (i = j = 0; i < num_rects; i++) { - boxes[j].x1 = rects[i].x; - if (boxes[j].x1 < 0) - boxes[j].x1 = 0; - boxes[j].x1 += tx; - - boxes[j].y1 = rects[i].y; - if (boxes[j].y1 < 0) - boxes[j].y1 = 0; - boxes[j].y1 += ty; - - boxes[j].x2 = bound(rects[i].x, rects[i].width); - if (boxes[j].x2 > maxx) - boxes[j].x2 = maxx; - boxes[j].x2 += tx; - - boxes[j].y2 = bound(rects[i].y, rects[i].height); - if (boxes[j].y2 > maxy) - boxes[j].y2 = maxy; - boxes[j].y2 += ty; + boxes[j].x1 = rects[i].x + tx; + if (boxes[j].x1 < extents->x1) + boxes[j].x1 = extents->x1; + + boxes[j].y1 = rects[i].y + ty; + if (boxes[j].y1 < extents->y1) + boxes[j].y1 = extents->y1; + + boxes[j].x2 = bound(rects[i].x + tx, rects[i].width); + if (boxes[j].x2 > extents->x2) + boxes[j].x2 = extents->x2; + + boxes[j].y2 = bound(rects[i].y + ty, rects[i].height); + if (boxes[j].y2 > extents->y2) + boxes[j].y2 = extents->y2; if (boxes[j].x2 > boxes[j].x1 && boxes[j].y2 > boxes[j].y1) j++; @@ -689,8 +685,9 @@ sna_composite_rectangles(CARD8 op, if (!_pixman_region_init_clipped_rectangles(®ion, num_rects, rects, - dst->pDrawable->x, dst->pDrawable->y, - dst->pDrawable->width, dst->pDrawable->height)) + dst->pDrawable->x, + dst->pDrawable->y, + &dst->pCompositeClip->extents)) { DBG(("%s: allocation failed for region\n", __FUNCTION__)); return; @@ -702,8 +699,9 @@ sna_composite_rectangles(CARD8 op, RegionExtents(®ion)->x2, RegionExtents(®ion)->y2, RegionNumRects(®ion))); - if (!pixman_region_intersect(®ion, ®ion, dst->pCompositeClip) || - region_is_empty(®ion)) { + if (dst->pCompositeClip->data && + (!pixman_region_intersect(®ion, ®ion, dst->pCompositeClip) || + region_is_empty(®ion))) { DBG(("%s: zero-intersection between rectangles and clip\n", __FUNCTION__)); pixman_region_fini(®ion); |