diff options
author | Andrea Canciani <ranma42@gmail.com> | 2011-07-30 23:34:28 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2011-07-30 23:34:28 +0200 |
commit | c8c7ee9b0ef6d08221fabc368727e2f9ef3c34b1 (patch) | |
tree | 582f7904f3d33965514d68ef8fd1c1c86a9f19ea | |
parent | 1bd25d3d6b2dbfcf0cd67e1c7938dfc25e544823 (diff) |
surface: no set successwip/objpostbackend7
-rw-r--r-- | src/cairo-surface.c | 134 |
1 files changed, 91 insertions, 43 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 025c27052..4aceed8a1 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -669,7 +669,8 @@ cairo_surface_unmap_image (cairo_surface_t *surface, error: cairo_surface_finish (image); cairo_surface_destroy (image); - if (status) + + if (unlikely (status)) _cairo_surface_set_error (surface, status); } @@ -1896,6 +1897,8 @@ _cairo_surface_composite (cairo_operator_t op, assert (op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_CLEAR); } + status = CAIRO_INT_STATUS_UNSUPPORTED; + if (dst->backend->composite) { status = dst->backend->composite (op, src, mask, dst, @@ -1904,18 +1907,22 @@ _cairo_surface_composite (cairo_operator_t op, dst_x, dst_y, width, height, clip_region); - if (status != CAIRO_INT_STATUS_UNSUPPORTED) - return _cairo_surface_set_error (dst, status); } - return _cairo_surface_set_error (dst, - _cairo_surface_fallback_composite (op, - src, mask, dst, - src_x, src_y, - mask_x, mask_y, - dst_x, dst_y, - width, height, - clip_region)); + if (status == CAIRO_INT_STATUS_UNSUPPORTED) { + status = _cairo_surface_fallback_composite (op, + src, mask, dst, + src_x, src_y, + mask_x, mask_y, + dst_x, dst_y, + width, height, + clip_region); + } + + if (unlikely (status)) + return _cairo_surface_set_error (dst, status); + + return CAIRO_STATUS_SUCCESS; } /** @@ -1978,7 +1985,10 @@ _cairo_surface_fill_region (cairo_surface_t *surface, if (rects != stack_rects) free (rects); - return _cairo_surface_set_error (surface, status); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + return CAIRO_STATUS_SUCCESS; } /** @@ -2014,18 +2024,24 @@ _cairo_surface_fill_rectangles (cairo_surface_t *surface, if (num_rects == 0) return CAIRO_STATUS_SUCCESS; + status = CAIRO_INT_STATUS_UNSUPPORTED; + if (surface->backend->fill_rectangles) { status = surface->backend->fill_rectangles (surface, op, color, rects, num_rects); - if (status != CAIRO_INT_STATUS_UNSUPPORTED) - return _cairo_surface_set_error (surface, status); } - return _cairo_surface_set_error (surface, - _cairo_surface_fallback_fill_rectangles (surface, - op, color, - rects, num_rects)); + if (status == CAIRO_INT_STATUS_UNSUPPORTED) { + status = _cairo_surface_fallback_fill_rectangles (surface, + op, color, + rects, num_rects); + } + + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + return CAIRO_STATUS_SUCCESS; } static cairo_status_t @@ -2090,7 +2106,10 @@ _cairo_surface_paint (cairo_surface_t *surface, if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) surface->is_clear = op == CAIRO_OPERATOR_CLEAR && clip == NULL; - return _cairo_surface_set_error (surface, status); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + return CAIRO_STATUS_SUCCESS; } cairo_status_t @@ -2146,7 +2165,10 @@ _cairo_surface_mask (cairo_surface_t *surface, if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) surface->is_clear = FALSE; - return _cairo_surface_set_error (surface, status); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + return CAIRO_STATUS_SUCCESS; } cairo_status_t @@ -2226,7 +2248,10 @@ _cairo_surface_fill_stroke (cairo_surface_t *surface, if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) surface->is_clear = FALSE; - return _cairo_surface_set_error (surface, status); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + return CAIRO_STATUS_SUCCESS; } cairo_status_t @@ -2285,7 +2310,10 @@ _cairo_surface_stroke (cairo_surface_t *surface, if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) surface->is_clear = FALSE; - return _cairo_surface_set_error (surface, status); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + return CAIRO_STATUS_SUCCESS; } cairo_status_t @@ -2340,7 +2368,10 @@ _cairo_surface_fill (cairo_surface_t *surface, if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) surface->is_clear = FALSE; - return _cairo_surface_set_error (surface, status); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + return CAIRO_STATUS_SUCCESS; } cairo_status_t @@ -2370,6 +2401,8 @@ _cairo_surface_composite_trapezoids (cairo_operator_t op, */ assert (op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_CLEAR); + status = CAIRO_INT_STATUS_UNSUPPORTED; + if (dst->backend->composite_trapezoids) { status = dst->backend->composite_trapezoids (op, pattern, dst, @@ -2379,18 +2412,22 @@ _cairo_surface_composite_trapezoids (cairo_operator_t op, width, height, traps, num_traps, clip_region); - if (status != CAIRO_INT_STATUS_UNSUPPORTED) - return _cairo_surface_set_error (dst, status); } - return _cairo_surface_set_error (dst, - _cairo_surface_fallback_composite_trapezoids (op, pattern, dst, - antialias, - src_x, src_y, - dst_x, dst_y, - width, height, - traps, num_traps, - clip_region)); + if (status == CAIRO_INT_STATUS_UNSUPPORTED) { + status = _cairo_surface_fallback_composite_trapezoids (op, pattern, dst, + antialias, + src_x, src_y, + dst_x, dst_y, + width, height, + traps, num_traps, + clip_region); + } + + if (unlikely (status)) + return _cairo_surface_set_error (dst, status); + + return CAIRO_STATUS_SUCCESS; } cairo_span_renderer_t * @@ -2742,7 +2779,10 @@ _cairo_surface_show_text_glyphs (cairo_surface_t *surface, if (status != CAIRO_INT_STATUS_NOTHING_TO_DO) surface->is_clear = FALSE; - return _cairo_surface_set_error (surface, status); + if (unlikely (status)) + return _cairo_surface_set_error (surface, status); + + return CAIRO_STATUS_SUCCESS; } /* XXX: Previously, we had a function named _cairo_surface_show_glyphs @@ -2765,6 +2805,8 @@ _cairo_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font, int num_glyphs, cairo_region_t *clip_region) { + cairo_status_t status; + if (unlikely (_cairo_surface_status (dst))) return _cairo_surface_status (dst); @@ -2773,14 +2815,17 @@ _cairo_surface_old_show_glyphs (cairo_scaled_font_t *scaled_font, if (dst->backend->old_show_glyphs == NULL) return CAIRO_INT_STATUS_UNSUPPORTED; - return _cairo_surface_set_error - (dst, dst->backend->old_show_glyphs (scaled_font, - op, pattern, dst, - source_x, source_y, - dest_x, dest_y, - width, height, - glyphs, num_glyphs, - clip_region)); + status = dst->backend->old_show_glyphs (scaled_font, + op, pattern, dst, + source_x, source_y, + dest_x, dest_y, + width, height, + glyphs, num_glyphs, + clip_region); + if (unlikely (status)) + return _cairo_surface_set_error (dst, status); + + return CAIRO_STATUS_SUCCESS; } static cairo_status_t @@ -2836,7 +2881,10 @@ _cairo_surface_composite_fixup_unbounded_internal (cairo_surface_t *dst, CLEANUP_REGIONS: _cairo_region_fini (&clear_region); - return _cairo_surface_set_error (dst, status); + if (unlikely (status)) + return _cairo_surface_set_error (dst, status); + + return CAIRO_STATUS_SUCCESS; } /** |