[cairo-commit] 2 commits - src/cairo.c src/cairo-clip.c
Chris Wilson
ickle at kemper.freedesktop.org
Thu May 10 01:39:12 PDT 2007
src/cairo-clip.c | 7 +++++--
src/cairo.c | 3 +++
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
diff-tree aec92188f1cf4ca34e890b0a4266425532f669d4 (from 1a719d1189243a76120b98371f84e074c8cd611e)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu May 10 09:29:24 2007 +0100
[cairo-clip] Correctly report allocation failure
Distinguish between the unrepresentable clip and the failure to allocate
the clip extents.
diff --git a/src/cairo-clip.c b/src/cairo-clip.c
index a3284d8..60f2418 100644
--- a/src/cairo-clip.c
+++ b/src/cairo-clip.c
@@ -656,8 +656,11 @@ _cairo_clip_copy_rectangle_list (cairo_c
} else {
cairo_rectangle_int16_t extents;
if (_cairo_surface_get_extents (_cairo_gstate_get_target (gstate),
- &extents) != CAIRO_STATUS_SUCCESS ||
- !_cairo_clip_rect_to_user(gstate, extents.x, extents.y,
+ &extents) != CAIRO_STATUS_SUCCESS) {
+ free (rectangles);
+ return (cairo_rectangle_list_t*) &_cairo_rectangles_nil;
+ }
+ if (! _cairo_clip_rect_to_user(gstate, extents.x, extents.y,
extents.width, extents.height,
rectangles)) {
free (rectangles);
diff-tree 1a719d1189243a76120b98371f84e074c8cd611e (from 3fbc4bb5ae27809f417ec2627fa515375e63a0e7)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu May 10 09:28:20 2007 +0100
[cairo] Use _cairo_clip_nil for CAIRO_STATUS_NO_MEMORY
When creating a error clip list for CAIRO_STATUS_NO_MEMORY, simply
reuse the nil object rather than allocate a fresh list.
diff --git a/src/cairo.c b/src/cairo.c
index 10fb0a8..2abc073 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -2407,6 +2407,9 @@ _cairo_rectangle_list_create_in_error (c
{
cairo_rectangle_list_t *list;
+ if (status == CAIRO_STATUS_NO_MEMORY)
+ return (cairo_rectangle_list_t*) &_cairo_rectangles_nil;
+
list = malloc (sizeof (cairo_rectangle_list_t));
if (list == NULL)
return (cairo_rectangle_list_t*) &_cairo_rectangles_nil;
More information about the cairo-commit
mailing list