summaryrefslogtreecommitdiff
path: root/src/cairo-gstate.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-03-18 16:10:39 +0100
committerAndrea Canciani <ranma42@gmail.com>2011-03-18 17:54:54 +0100
commitf2eb3f2178b6b7a75da4fb5e5bd880b769b69e62 (patch)
treea48a28a3341aea2cdecfa1580af76899b4950c61 /src/cairo-gstate.c
parent7db5e3fdc8ea368547bb0b8f15d190c4f6891e20 (diff)
downloadcairo-f2eb3f2178b6b7a75da4fb5e5bd880b769b69e62.tar.gz
Improve cairo_rectangle_list_t error handling
Unify the _cairo_rectangle_list_create_in_error() functions, keeping the best features from both (the one in cairo-clip.c statically allocates the most common cases, the one in cairo.c throws a NO_MEMORY error when it cannot malloc() instead of rethrowing the same error). The same function can be used to return an error-list in _cairo_gstate_copy_clip_rectangle_list() when _cairo_clip_rectangle() fails (for example becaouse of an OOM).
Diffstat (limited to 'src/cairo-gstate.c')
-rw-r--r--src/cairo-gstate.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index eaf7a56aa..9fd3600f7 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1560,11 +1560,17 @@ _cairo_gstate_copy_clip_rectangle_list (cairo_gstate_t *gstate)
cairo_clip_t clip;
cairo_rectangle_int_t extents;
cairo_rectangle_list_t *list;
+ cairo_status_t status;
_cairo_clip_init_copy (&clip, &gstate->clip);
if (_cairo_surface_get_extents (gstate->target, &extents))
- _cairo_clip_rectangle (&clip, &extents);
+ status = _cairo_clip_rectangle (&clip, &extents);
+ else
+ status = CAIRO_STATUS_SUCCESS;
+
+ if (unlikely (status))
+ return _cairo_rectangle_list_create_in_error (status);
list = _cairo_clip_copy_rectangle_list (&clip, gstate);
_cairo_clip_fini (&clip);