[cairo-commit] src/cairo-surface-fallback.c
Chris Wilson
ickle at kemper.freedesktop.org
Thu May 6 06:40:31 PDT 2010
src/cairo-surface-fallback.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
New commits:
commit a2a2bd62ff37e2642f671ca7ebf26954e1856abe
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu May 6 14:39:30 2010 +0100
surface-fallback: Handle memfaults during clipping.
Don't be lazy, propagate the error rather than asserting.
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index 5c01c4e..25d03e6 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;
}
More information about the cairo-commit
mailing list