diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-04-03 09:23:58 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-04-16 09:34:02 +0100 |
commit | ad83765a1441cb369c3e7f3de77c243297406c7a (patch) | |
tree | a1c6f86bb06ddb6f8ad4361abae177a8787d3f52 /src/cairo-region.c | |
parent | 75b06b8bdb5efaf030e063c1f66583d8fde347dc (diff) | |
download | cairo-ad83765a1441cb369c3e7f3de77c243297406c7a.tar.gz |
[xlib] Allocate bounded region on stack.
Eliminate the extremely short-lived and oft unnecessary heap allocation
of the region by first checking to see whether the clip exceeds the
surface bounds and only then intersect the clip with a local
stack-allocated region.
Diffstat (limited to 'src/cairo-region.c')
-rw-r--r-- | src/cairo-region.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/cairo-region.c b/src/cairo-region.c index 15bf2f167..5d1f2c5ff 100644 --- a/src/cairo-region.c +++ b/src/cairo-region.c @@ -76,6 +76,29 @@ _cairo_region_set_error (cairo_region_t *region, return _cairo_error (status); } +void +_cairo_region_init (cairo_region_t *region) +{ + region->status = CAIRO_STATUS_SUCCESS; + pixman_region32_init (®ion->rgn); +} + +void +_cairo_region_init_rectangle (cairo_region_t *region, + const cairo_rectangle_int_t *rectangle) +{ + region->status = CAIRO_STATUS_SUCCESS; + pixman_region32_init_rect (®ion->rgn, + rectangle->x, rectangle->y, + rectangle->width, rectangle->height); +} + +void +_cairo_region_fini (cairo_region_t *region) +{ + pixman_region32_fini (®ion->rgn); +} + /** * cairo_region_create: * |