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-win32-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-win32-surface.c')
-rw-r--r-- | src/cairo-win32-surface.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c index f0c7aa2c..f182642f 100644 --- a/src/cairo-win32-surface.c +++ b/src/cairo-win32-surface.c @@ -1461,36 +1461,36 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface, /* Then combine any new region with it */ if (region) { cairo_rectangle_int_t extents; - int num_boxes; + int num_rects; RGNDATA *data; size_t data_size; RECT *rects; int i; HRGN gdi_region; - cairo_box_int_t box0; + cairo_rectangle_int_t rect0; /* Create a GDI region for the cairo region */ _cairo_region_get_extents (region, &extents); - num_boxes = _cairo_region_num_boxes (region); + num_rects = _cairo_region_num_rectangles (region); - if (num_boxes == 1) - _cairo_region_get_box (region, 0, &box0); + if (num_rects == 1) + _cairo_region_get_rectangle (region, 0, &rect0); - if (num_boxes == 1 && - box0.p1.x == 0 && - box0.p1.y == 0 && - box0.p2.x == surface->extents.width && - box0.p2.y == surface->extents.height) + if (num_rects == 1 && + rect0.x == 0 && + rect0.y == 0 && + rect0.width == surface->extents.width && + rect0.width == surface->extents.height) { gdi_region = NULL; SelectClipRgn (surface->dc, NULL); IntersectClipRect (surface->dc, - box0.p1.x, - box0.p1.y, - box0.p2.x, - box0.p2.y); + rect0.x, + rect0.y, + rect0.x + rect0.width, + rect0.y + rect0.height); } else { /* XXX see notes in _cairo_win32_save_initial_clip -- * this code will interact badly with a HDC which had an initial @@ -1499,7 +1499,7 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface, * logical units (unlike IntersectClipRect). */ - data_size = sizeof (RGNDATAHEADER) + num_boxes * sizeof (RECT); + data_size = sizeof (RGNDATAHEADER) + num_rects * sizeof (RECT); data = malloc (data_size); if (!data) return _cairo_error(CAIRO_STATUS_NO_MEMORY); @@ -1507,22 +1507,22 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface, data->rdh.dwSize = sizeof (RGNDATAHEADER); data->rdh.iType = RDH_RECTANGLES; - data->rdh.nCount = num_boxes; - data->rdh.nRgnSize = num_boxes * sizeof (RECT); + data->rdh.nCount = num_rects; + data->rdh.nRgnSize = num_rects * sizeof (RECT); data->rdh.rcBound.left = extents.x; data->rdh.rcBound.top = extents.y; data->rdh.rcBound.right = extents.x + extents.width; data->rdh.rcBound.bottom = extents.y + extents.height; - for (i = 0; i < num_boxes; i++) { - cairo_box_int_t box; + for (i = 0; i < num_rects; i++) { + cairo_rectangle_int_t rect; - _cairo_region_get_box (region, i, &box); + _cairo_region_get_rectangle (region, i, &rect); - rects[i].left = box.p1.x; - rects[i].top = box.p1.y; - rects[i].right = box.p2.x; - rects[i].bottom = box.p2.y; + rects[i].left = rect.x; + rects[i].top = rect.y; + rects[i].right = rect.x + rect.width; + rects[i].bottom = rect.y + rect.height; } gdi_region = ExtCreateRegion (NULL, data_size, data); |