diff --git a/AUTHORS b/AUTHORS index b86eac31f..3be11047e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,5 @@ Olivier Andrieu PNG backend +Peter Dennis Bartok Bug fix for clipping Dave Beckett Track rename of libpixman, build fixes Andrew Chant Adding const where needed John Ellson First font/glyph extents functions @@ -13,6 +14,7 @@ David Reveman New pattern API, OpenGL backend Jamey Sharp Surface/font backend virtualization, XCB backend Bill Spitzak Build fix to find Xrender.h without xrender.pc Sasha Vasko Build fix to compile without xlib backend +Vladimir Vukicevic Bug fix for clipping Carl Worth Original library, support for paths, images Richard D. Worth Build fixes for cygwin diff --git a/ChangeLog b/ChangeLog index 2e98fe3d8..7ffc1dae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2004-08-14 Carl Worth + * src/cairo_image_surface.c + (_cairo_image_surface_set_clip_region): Make a copy of the region + since pixman is currently taking ownership of it (ugh). Thanks to + Vladimir Vukicevic and Peter Dennis Bartok + . + * autogen.sh (LANG): Explicitly set LANG=C to fix the awk string->number conversion for user with locales that don't match ASCII digit conventions. diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 84de8d97d..ec223945a 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -455,7 +455,20 @@ cairo_int_status_t _cairo_image_surface_set_clip_region (cairo_image_surface_t *surface, pixman_region16_t *region) { - pixman_image_set_clip_region (surface->pixman_image, region); + if (region) { + pixman_region16_t *rcopy; + + rcopy = pixman_region_create(); + /* pixman_image_set_clip_region expects to take ownership of the + * passed-in region, so we create a copy to give it. */ + /* XXX: I think that's probably a bug in pixman. But its + * memory management issues need auditing anyway, so a + * workaround like this is fine for now. */ + pixman_region_copy (rcopy, region); + pixman_image_set_clip_region (surface->pixman_image, rcopy); + } else { + pixman_image_set_clip_region (surface->pixman_image, region); + } return CAIRO_STATUS_SUCCESS; } diff --git a/src/cairo_image_surface.c b/src/cairo_image_surface.c index 84de8d97d..ec223945a 100644 --- a/src/cairo_image_surface.c +++ b/src/cairo_image_surface.c @@ -455,7 +455,20 @@ cairo_int_status_t _cairo_image_surface_set_clip_region (cairo_image_surface_t *surface, pixman_region16_t *region) { - pixman_image_set_clip_region (surface->pixman_image, region); + if (region) { + pixman_region16_t *rcopy; + + rcopy = pixman_region_create(); + /* pixman_image_set_clip_region expects to take ownership of the + * passed-in region, so we create a copy to give it. */ + /* XXX: I think that's probably a bug in pixman. But its + * memory management issues need auditing anyway, so a + * workaround like this is fine for now. */ + pixman_region_copy (rcopy, region); + pixman_image_set_clip_region (surface->pixman_image, rcopy); + } else { + pixman_image_set_clip_region (surface->pixman_image, region); + } return CAIRO_STATUS_SUCCESS; }