[cairo-commit] src/cairo-spans-compositor.c src/cairo-surface.c src/cairo-surface-private.h

Chris Wilson ickle at kemper.freedesktop.org
Wed Oct 12 06:54:19 PDT 2011


 src/cairo-spans-compositor.c |    8 ++++++--
 src/cairo-surface-private.h  |    3 +++
 src/cairo-surface.c          |   21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit b2aa687de6f6c3bf915c492126101311395e2692
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Oct 12 14:50:41 2011 +0100

    spans: Propagate internal status when retrieving the clip surface
    
    Including the information that there is nothing to do due to being
    all-clipped-out.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-spans-compositor.c b/src/cairo-spans-compositor.c
index 9d7b0ac..a4efa48 100644
--- a/src/cairo-spans-compositor.c
+++ b/src/cairo-spans-compositor.c
@@ -212,7 +212,7 @@ cleanup_polygon:
     _cairo_polygon_fini (&polygon);
 error:
     cairo_surface_destroy (surface);
-    return _cairo_surface_create_in_error (status);
+    return _cairo_int_surface_create_in_error (status);
 }
 
 static cairo_int_status_t
@@ -226,8 +226,12 @@ fixup_unbounded_mask (const cairo_spans_compositor_t *compositor,
 
     clip = get_clip_surface (compositor, extents->surface, extents->clip,
 			     &extents->unbounded);
-    if (unlikely (clip->status))
+    if (unlikely (clip->status)) {
+	if ((cairo_int_status_t)clip->status == CAIRO_INT_STATUS_NOTHING_TO_DO)
+	    return CAIRO_STATUS_SUCCESS;
+
 	return clip->status;
+    }
 
     status = _cairo_composite_rectangles_init_for_boxes (&composite,
 							 extents->surface,
diff --git a/src/cairo-surface-private.h b/src/cairo-surface-private.h
index 0bebfde..5a66480 100644
--- a/src/cairo-surface-private.h
+++ b/src/cairo-surface-private.h
@@ -102,4 +102,7 @@ struct _cairo_surface {
     cairo_font_options_t font_options;
 };
 
+cairo_private cairo_surface_t *
+_cairo_int_surface_create_in_error (cairo_int_status_t status);
+
 #endif /* CAIRO_SURFACE_PRIVATE_H */
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 0810f18..c026a3d 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -147,6 +147,9 @@ static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_SIZE, _cairo_surface_nil_invalid_
 static DEFINE_NIL_SURFACE(CAIRO_STATUS_DEVICE_TYPE_MISMATCH, _cairo_surface_nil_device_type_mismatch);
 static DEFINE_NIL_SURFACE(CAIRO_STATUS_DEVICE_ERROR, _cairo_surface_nil_device_error);
 
+static DEFINE_NIL_SURFACE(CAIRO_INT_STATUS_UNSUPPORTED, _cairo_surface_nil_unsupported);
+static DEFINE_NIL_SURFACE(CAIRO_INT_STATUS_NOTHING_TO_DO, _cairo_surface_nil_nothing_to_do);
+
 /**
  * _cairo_surface_set_error:
  * @surface: a surface
@@ -2259,6 +2262,7 @@ _cairo_surface_set_resolution (cairo_surface_t *surface,
 cairo_surface_t *
 _cairo_surface_create_in_error (cairo_status_t status)
 {
+    assert (status < CAIRO_STATUS_LAST_STATUS);
     switch (status) {
     case CAIRO_STATUS_NO_MEMORY:
 	return (cairo_surface_t *) &_cairo_surface_nil;
@@ -2321,5 +2325,22 @@ _cairo_surface_create_in_error (cairo_status_t status)
     }
 }
 
+cairo_surface_t *
+_cairo_int_surface_create_in_error (cairo_int_status_t status)
+{
+    if (status < CAIRO_INT_STATUS_LAST_STATUS)
+	return _cairo_surface_create_in_error (status);
+
+    switch ((int)status) {
+    case CAIRO_INT_STATUS_UNSUPPORTED:
+	return (cairo_surface_t *) &_cairo_surface_nil_unsupported;
+    case CAIRO_INT_STATUS_NOTHING_TO_DO:
+	return (cairo_surface_t *) &_cairo_surface_nil_nothing_to_do;
+    default:
+	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
+	return (cairo_surface_t *) &_cairo_surface_nil;
+    }
+}
+
 /*  LocalWords:  rasterized
  */


More information about the cairo-commit mailing list