diff options
author | Søren Sandmann Pedersen <sandmann@daimi.au.dk> | 2009-02-16 05:41:31 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <sandmann@daimi.au.dk> | 2009-03-28 18:01:19 -0400 |
commit | ebd0e685ae2d76c3af96d748a33a7194c70749f3 (patch) | |
tree | 13f7d867f10785815bbbe4f95d3c2e1098041a63 /src/cairo-surface.c | |
parent | c29aeee2d3569cd43e88adc05662bb6306987b8b (diff) |
[region] Consistently use rectangles in the API of regions
Usually, rectangles are more useful than boxes, so regions should only
expose rectangles in their public API.
Specifically,
_cairo_region_num_boxes becomes _cairo_region_num_rectangles
_cairo_region_get_box becomes _cairo_region_get_rectangle
Remove the cairo_box_int_t type
Diffstat (limited to 'src/cairo-surface.c')
-rw-r--r-- | src/cairo-surface.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 635575ac..42fc6da8 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -1570,14 +1570,13 @@ _cairo_surface_fill_rectangle (cairo_surface_t *surface, * * Return value: %CAIRO_STATUS_SUCCESS or the error that occurred **/ -COMPILE_TIME_ASSERT (sizeof (cairo_box_int_t) <= sizeof (cairo_rectangle_int_t)); cairo_status_t _cairo_surface_fill_region (cairo_surface_t *surface, cairo_operator_t op, const cairo_color_t *color, cairo_region_t *region) { - int num_boxes; + int num_rects; cairo_rectangle_int_t stack_rects[CAIRO_STACK_ARRAY_LENGTH (cairo_rectangle_int_t)]; cairo_rectangle_int_t *rects = stack_rects; cairo_status_t status; @@ -1588,12 +1587,12 @@ _cairo_surface_fill_region (cairo_surface_t *surface, assert (! surface->is_snapshot); - num_boxes = _cairo_region_num_boxes (region); - if (num_boxes == 0) + num_rects = _cairo_region_num_rectangles (region); + if (num_rects == 0) return CAIRO_STATUS_SUCCESS; - if (num_boxes > ARRAY_LENGTH (stack_rects)) { - rects = _cairo_malloc_ab (num_boxes, + if (num_rects > ARRAY_LENGTH (stack_rects)) { + rects = _cairo_malloc_ab (num_rects, sizeof (cairo_rectangle_int_t)); if (rects == NULL) { return _cairo_surface_set_error (surface, @@ -1601,19 +1600,11 @@ _cairo_surface_fill_region (cairo_surface_t *surface, } } - for (i = 0; i < num_boxes; i++) { - cairo_box_int_t box; - - _cairo_region_get_box (region, i, &box); - - rects[i].x = box.p1.x; - rects[i].y = box.p1.y; - rects[i].width = box.p2.x - rects[i].x; - rects[i].height = box.p2.y - rects[i].y; - } + for (i = 0; i < num_rects; i++) + _cairo_region_get_rectangle (region, i, &rects[i]); status = _cairo_surface_fill_rectangles (surface, op, - color, rects, num_boxes); + color, rects, num_rects); if (rects != stack_rects) free (rects); |