diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-08-28 10:05:52 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-08-29 08:08:33 +0100 |
commit | 3f12d9ec5db1ac372742c3c03408bdaeaffdc1e4 (patch) | |
tree | a46be582bac6364db75df1c5c32ef79ab2538e2f /src/cairo-rectangle.c | |
parent | 2457c4bedef0447f7bff9b54dba96126010917ac (diff) |
[clip] Use geometric clipping for unaligned clips
For the simple cases where the clip is an unaligned box (or boxes), apply
the clip directly to the geometry and avoid having to use an intermediate
clip-mask.
Diffstat (limited to 'src/cairo-rectangle.c')
-rw-r--r-- | src/cairo-rectangle.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/cairo-rectangle.c b/src/cairo-rectangle.c index b1396248..e887c751 100644 --- a/src/cairo-rectangle.c +++ b/src/cairo-rectangle.c @@ -71,6 +71,29 @@ _cairo_box_from_rectangle (cairo_box_t *box, box->p2.y = _cairo_fixed_from_int (rect->y + rect->height); } +void +_cairo_boxes_get_extents (const cairo_box_t *boxes, + int num_boxes, + cairo_box_t *extents) +{ + int n; + + assert (num_boxes > 0); + *extents = *boxes; + + for (n = 1; n < num_boxes; n++) { + if (boxes[n].p1.x < extents->p1.x) + extents->p1.x = boxes[n].p1.x; + if (boxes[n].p2.x > extents->p2.x) + extents->p2.x = boxes[n].p2.x; + + if (boxes[n].p1.y < extents->p1.y) + extents->p1.y = boxes[n].p1.y; + if (boxes[n].p2.y > extents->p2.y) + extents->p2.y = boxes[n].p2.y; + } +} + /* XXX We currently have a confusing mix of boxes and rectangles as * exemplified by this function. A #cairo_box_t is a rectangular area * represented by the coordinates of the upper left and lower right |