diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-06 14:39:30 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-05-06 14:40:19 +0100 |
commit | a2a2bd62ff37e2642f671ca7ebf26954e1856abe (patch) | |
tree | 80c1554ff1fe0625a223c6e780e2f4af617f181c | |
parent | 2e3acee410ff127d4557ca8191625338cd225313 (diff) |
surface-fallback: Handle memfaults during clipping.
Don't be lazy, propagate the error rather than asserting.
-rw-r--r-- | src/cairo-surface-fallback.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c index 5c01c4e7..25d03e62 100644 --- a/src/cairo-surface-fallback.c +++ b/src/cairo-surface-fallback.c @@ -133,10 +133,11 @@ _create_composite_mask_pattern (cairo_surface_pattern_t *mask_pattern, if (clip != NULL) { status = _cairo_clip_get_region (clip, &clip_region); - assert (! _cairo_status_is_error (status)); - - /* The all-clipped state should never propagate this far. */ - assert (status != CAIRO_INT_STATUS_NOTHING_TO_DO); + if (unlikely (_cairo_status_is_error (status) || + status == CAIRO_INT_STATUS_NOTHING_TO_DO)) + { + return status; + } clip_surface = status == CAIRO_INT_STATUS_UNSUPPORTED; } @@ -346,12 +347,13 @@ _clip_and_composite_source (cairo_clip_t *clip, if (clip != NULL) { status = _cairo_clip_get_region (clip, &clip_region); - assert (! _cairo_status_is_error (status)); - if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO)) - return CAIRO_STATUS_SUCCESS; + if (unlikely (_cairo_status_is_error (status) || + status == CAIRO_INT_STATUS_NOTHING_TO_DO)) + { + return status; + } } - /* Create a surface that is mask IN clip */ status = _create_composite_mask_pattern (&mask_pattern, clip, @@ -444,9 +446,11 @@ _clip_and_composite (cairo_clip_t *clip, if (clip != NULL) { status = _cairo_clip_get_region (clip, &clip_region); - assert (! _cairo_status_is_error (status)); - if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO)) - return CAIRO_STATUS_SUCCESS; + if (unlikely (_cairo_status_is_error (status) || + status == CAIRO_INT_STATUS_NOTHING_TO_DO)) + { + return status; + } clip_surface = status == CAIRO_INT_STATUS_UNSUPPORTED; } |