[PATCH] Use 32 bit pixman regions for cairo_region_t
Søren Sandmann
sandmann at redhat.com
Sun Jun 8 21:43:47 PDT 2008
---
src/cairo-image-surface.c | 2 +-
src/cairo-region-private.h | 2 +-
src/cairo-region.c | 38 +++++++++++++++++++-------------------
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index cd80aed..d25cb96 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1193,7 +1193,7 @@ _cairo_image_surface_set_clip_region (void *abstract_surface,
{
cairo_image_surface_t *surface = (cairo_image_surface_t *) abstract_surface;
- if (! pixman_image_set_clip_region (surface->pixman_image, ®ion->rgn))
+ if (! pixman_image_set_clip_region32 (surface->pixman_image, ®ion->rgn))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
surface->has_clip = region != NULL;
diff --git a/src/cairo-region-private.h b/src/cairo-region-private.h
index 4e2d723..53c1e8a 100644
--- a/src/cairo-region-private.h
+++ b/src/cairo-region-private.h
@@ -44,7 +44,7 @@
/* #cairo_region_t is defined in cairoint.h */
struct _cairo_region {
- pixman_region16_t rgn;
+ pixman_region32_t rgn;
};
cairo_private void
diff --git a/src/cairo-region.c b/src/cairo-region.c
index d78628e..746b3b1 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -40,14 +40,14 @@
void
_cairo_region_init (cairo_region_t *region)
{
- pixman_region_init (®ion->rgn);
+ pixman_region32_init (®ion->rgn);
}
void
_cairo_region_init_rect (cairo_region_t *region,
cairo_rectangle_int_t *rect)
{
- pixman_region_init_rect (®ion->rgn,
+ pixman_region32_init_rect (®ion->rgn,
rect->x, rect->y,
rect->width, rect->height);
}
@@ -57,13 +57,13 @@ _cairo_region_init_boxes (cairo_region_t *region,
cairo_box_int_t *boxes,
int count)
{
- pixman_box16_t stack_pboxes[CAIRO_STACK_ARRAY_LENGTH (pixman_box16_t)];
- pixman_box16_t *pboxes = stack_pboxes;
+ pixman_box32_t stack_pboxes[CAIRO_STACK_ARRAY_LENGTH (pixman_box32_t)];
+ pixman_box32_t *pboxes = stack_pboxes;
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
int i;
if (count > ARRAY_LENGTH(stack_pboxes)) {
- pboxes = _cairo_malloc_ab (count, sizeof(pixman_box16_t));
+ pboxes = _cairo_malloc_ab (count, sizeof(pixman_box32_t));
if (pboxes == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
@@ -75,7 +75,7 @@ _cairo_region_init_boxes (cairo_region_t *region,
pboxes[i].y2 = boxes[i].p2.y;
}
- if (!pixman_region_init_rects (®ion->rgn, pboxes, count))
+ if (!pixman_region32_init_rects (®ion->rgn, pboxes, count))
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
if (pboxes != stack_pboxes)
@@ -87,13 +87,13 @@ _cairo_region_init_boxes (cairo_region_t *region,
void
_cairo_region_fini (cairo_region_t *region)
{
- pixman_region_fini (®ion->rgn);
+ pixman_region32_fini (®ion->rgn);
}
cairo_int_status_t
_cairo_region_copy (cairo_region_t *dst, cairo_region_t *src)
{
- if (!pixman_region_copy (&dst->rgn, &src->rgn))
+ if (!pixman_region32_copy (&dst->rgn, &src->rgn))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
return CAIRO_STATUS_SUCCESS;
@@ -102,18 +102,18 @@ _cairo_region_copy (cairo_region_t *dst, cairo_region_t *src)
int
_cairo_region_num_boxes (cairo_region_t *region)
{
- return pixman_region_n_rects (®ion->rgn);
+ return pixman_region32_n_rects (®ion->rgn);
}
cairo_int_status_t
_cairo_region_get_boxes (cairo_region_t *region, int *num_boxes, cairo_box_int_t **boxes)
{
int nboxes;
- pixman_box16_t *pboxes;
+ pixman_box32_t *pboxes;
cairo_box_int_t *cboxes;
int i;
- pboxes = pixman_region_rectangles (®ion->rgn, &nboxes);
+ pboxes = pixman_region32_rectangles (®ion->rgn, &nboxes);
if (nboxes == 0) {
*num_boxes = 0;
@@ -154,7 +154,7 @@ _cairo_region_boxes_fini (cairo_region_t *region, cairo_box_int_t *boxes)
void
_cairo_region_get_extents (cairo_region_t *region, cairo_rectangle_int_t *extents)
{
- pixman_box16_t *pextents = pixman_region_extents (®ion->rgn);
+ pixman_box32_t *pextents = pixman_region32_extents (®ion->rgn);
extents->x = pextents->x1;
extents->y = pextents->y1;
@@ -165,7 +165,7 @@ _cairo_region_get_extents (cairo_region_t *region, cairo_rectangle_int_t *extent
cairo_int_status_t
_cairo_region_subtract (cairo_region_t *dst, cairo_region_t *a, cairo_region_t *b)
{
- if (!pixman_region_subtract (&dst->rgn, &a->rgn, &b->rgn))
+ if (!pixman_region32_subtract (&dst->rgn, &a->rgn, &b->rgn))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
return CAIRO_STATUS_SUCCESS;
@@ -174,7 +174,7 @@ _cairo_region_subtract (cairo_region_t *dst, cairo_region_t *a, cairo_region_t *
cairo_int_status_t
_cairo_region_intersect (cairo_region_t *dst, cairo_region_t *a, cairo_region_t *b)
{
- if (!pixman_region_intersect (&dst->rgn, &a->rgn, &b->rgn))
+ if (!pixman_region32_intersect (&dst->rgn, &a->rgn, &b->rgn))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
return CAIRO_STATUS_SUCCESS;
@@ -185,7 +185,7 @@ _cairo_region_union_rect (cairo_region_t *dst,
cairo_region_t *src,
cairo_rectangle_int_t *rect)
{
- if (!pixman_region_union_rect (&dst->rgn, &src->rgn,
+ if (!pixman_region32_union_rect (&dst->rgn, &src->rgn,
rect->x, rect->y,
rect->width, rect->height))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@@ -196,25 +196,25 @@ _cairo_region_union_rect (cairo_region_t *dst,
cairo_bool_t
_cairo_region_not_empty (cairo_region_t *region)
{
- return (cairo_bool_t) pixman_region_not_empty (®ion->rgn);
+ return (cairo_bool_t) pixman_region32_not_empty (®ion->rgn);
}
void
_cairo_region_translate (cairo_region_t *region,
int x, int y)
{
- pixman_region_translate (®ion->rgn, x, y);
+ pixman_region32_translate (®ion->rgn, x, y);
}
pixman_region_overlap_t
_cairo_region_contains_rectangle (cairo_region_t *region, cairo_rectangle_int_t *rect)
{
- pixman_box16_t pbox;
+ pixman_box32_t pbox;
pbox.x1 = rect->x;
pbox.y1 = rect->y;
pbox.x2 = rect->x + rect->width;
pbox.y2 = rect->y + rect->height;
- return pixman_region_contains_rectangle (®ion->rgn, &pbox);
+ return pixman_region32_contains_rectangle (®ion->rgn, &pbox);
}
--
1.5.4.5
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=0004-Fix-xlib-incarnation-of-the-large-clip-bug.patch
Content-Description: Clip to surface size before generating clip rects
More information about the cairo
mailing list