diff options
Diffstat (limited to 'src/cairo-xcb-surface-render.c')
-rw-r--r-- | src/cairo-xcb-surface-render.c | 141 |
1 files changed, 82 insertions, 59 deletions
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c index e7628f499..ceeb6d049 100644 --- a/src/cairo-xcb-surface-render.c +++ b/src/cairo-xcb-surface-render.c @@ -370,7 +370,7 @@ _picture_from_image (cairo_xcb_surface_t *target, picture = _cairo_xcb_picture_create (target->screen, image->pixman_format, format, image->width, image->height); - if (likely (picture->base.status == CAIRO_STATUS_SUCCESS)) { + if (likely (_cairo_surface_status (&picture->base) == CAIRO_STATUS_SUCCESS)) { _cairo_xcb_connection_render_create_picture (target->connection, picture->picture, pixmap, format, 0, 0); @@ -587,7 +587,7 @@ _solid_picture (cairo_xcb_surface_t *target, PIXMAN_a8r8g8b8, xrender_format, -1, -1); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; if (target->flags & CAIRO_XCB_RENDER_HAS_GRADIENTS) { @@ -653,7 +653,7 @@ _cairo_xcb_transparent_picture (cairo_xcb_surface_t *target) target->screen->stock_colors[CAIRO_STOCK_TRANSPARENT] = &picture->base; } - return (cairo_xcb_picture_t *) cairo_surface_reference (&picture->base); + return (cairo_xcb_picture_t *) _cairo_surface_reference (&picture->base); } static cairo_xcb_picture_t * @@ -667,7 +667,7 @@ _cairo_xcb_black_picture (cairo_xcb_surface_t *target) target->screen->stock_colors[CAIRO_STOCK_BLACK] = &picture->base; } - return (cairo_xcb_picture_t *) cairo_surface_reference (&picture->base); + return (cairo_xcb_picture_t *) _cairo_surface_reference (&picture->base); } static cairo_xcb_picture_t * @@ -681,7 +681,7 @@ _cairo_xcb_white_picture (cairo_xcb_surface_t *target) target->screen->stock_colors[CAIRO_STOCK_WHITE] = &picture->base; } - return (cairo_xcb_picture_t *) cairo_surface_reference (&picture->base); + return (cairo_xcb_picture_t *) _cairo_surface_reference (&picture->base); } static cairo_xcb_picture_t * @@ -715,12 +715,12 @@ _cairo_xcb_solid_picture (cairo_xcb_surface_t *target, n_cached = screen->solid_cache_size; for (i = 0; i < n_cached; i++) { if (_cairo_color_equal (&screen->solid_cache[i].color, &pattern->color)) { - return (cairo_xcb_picture_t *) cairo_surface_reference (screen->solid_cache[i].picture); + return (cairo_xcb_picture_t *) _cairo_surface_reference (screen->solid_cache[i].picture); } } picture = _solid_picture (target, &pattern->color); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; if (screen->solid_cache_size < ARRAY_LENGTH (screen->solid_cache)) { @@ -729,7 +729,7 @@ _cairo_xcb_solid_picture (cairo_xcb_surface_t *target, i = hars_petruska_f54_1_random () % ARRAY_LENGTH (screen->solid_cache); cairo_surface_destroy (screen->solid_cache[i].picture); } - screen->solid_cache[i].picture = cairo_surface_reference (&picture->base); + screen->solid_cache[i].picture = _cairo_surface_reference (&picture->base); screen->solid_cache[i].color = pattern->color; return picture; @@ -775,7 +775,7 @@ _render_to_picture (cairo_xcb_surface_t *target, picture = _picture_from_image (target, xrender_format, image, shm_info); cairo_surface_destroy (&image->base); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; _cairo_xcb_picture_set_component_alpha (picture, pattern->has_component_alpha); @@ -866,7 +866,7 @@ _cairo_xcb_linear_picture (cairo_xcb_surface_t *target, target->screen->connection->standard_formats[CAIRO_FORMAT_ARGB32], PIXMAN_a8r8g8b8, -1, -1); - if (unlikely (picture->base.status)) { + if (unlikely (_cairo_surface_status (&picture->base))) { if (stops != (xcb_render_fixed_t *) buf) free (stops); return picture; @@ -941,7 +941,7 @@ _cairo_xcb_radial_picture (cairo_xcb_surface_t *target, target->screen->connection->standard_formats[CAIRO_FORMAT_ARGB32], PIXMAN_a8r8g8b8, -1, -1); - if (unlikely (picture->base.status)) { + if (unlikely (_cairo_surface_status (&picture->base))) { if (stops != (xcb_render_fixed_t *) buf) free (stops); return picture; @@ -1009,7 +1009,7 @@ _copy_to_picture (cairo_xcb_surface_t *source) source->pixman_format, source->width, source->height); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; _cairo_xcb_connection_render_create_picture (source->connection, @@ -1047,7 +1047,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, _cairo_surface_has_snapshot (source, &_cairo_xcb_picture_backend); if (picture != NULL) { if (picture->screen == target->screen) { - picture = (cairo_xcb_picture_t *) cairo_surface_reference (&picture->base); + picture = (cairo_xcb_picture_t *) _cairo_surface_reference (&picture->base); goto setup_picture; } picture = NULL; @@ -1058,7 +1058,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, if (source->backend->type == CAIRO_SURFACE_TYPE_XCB) { if (((cairo_xcb_surface_t *) source)->screen == target->screen) { picture = _copy_to_picture ((cairo_xcb_surface_t *) source); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; } } else if (source->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) { @@ -1070,7 +1070,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, xcb_rectangle_t rect; picture = _copy_to_picture (xcb); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; rect.x = sub->extents.x; @@ -1093,7 +1093,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, if (xcb->screen == target->screen) { picture = _copy_to_picture (xcb); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; } } @@ -1104,7 +1104,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, if (source->backend->type == CAIRO_SURFACE_TYPE_XLIB) { if (((cairo_xlib_xcb_surface_t *) source)->xcb->screen == target->screen) { picture = _copy_to_picture (((cairo_xlib_xcb_surface_t *) source)->xcb); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; } } else if (source->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) { @@ -1115,7 +1115,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, xcb_rectangle_t rect; picture = _copy_to_picture (xcb); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; rect.x = sub->extents.x; @@ -1138,7 +1138,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, if (xcb->screen == target->screen) { picture = _copy_to_picture (xcb); - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; } } @@ -1244,7 +1244,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, conv = _cairo_image_surface_coerce (image); _cairo_surface_release_source_image (source, image, image_extra); - if (unlikely (conv->base.status)) + if (unlikely (_cairo_surface_status (&conv->base))) return (cairo_xcb_picture_t *) conv; render_format = target->screen->connection->standard_formats[conv->format]; @@ -1252,7 +1252,7 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target, cairo_surface_destroy (&conv->base); } - if (unlikely (picture->base.status)) + if (unlikely (_cairo_surface_status (&picture->base))) return picture; } @@ -1417,7 +1417,7 @@ _render_composite_boxes (cairo_xcb_surface_t *dst, } src = _cairo_xcb_picture_for_pattern (dst, src_pattern, extents); - status = src->base.status; + status = _cairo_surface_status (&src->base); if (unlikely (status)) goto cleanup_boxes; @@ -1459,7 +1459,7 @@ _render_composite_boxes (cairo_xcb_surface_t *dst, if (mask_pattern != NULL) { mask = _cairo_xcb_picture_for_pattern (dst, mask_pattern, extents); - status = mask->base.status; + status = _cairo_surface_status (&mask->base); if (unlikely (status)) goto cleanup_clip; @@ -1567,10 +1567,12 @@ _composite_traps (void *closure, xcb_render_trapezoid_t *xtraps; int render_reference_x, render_reference_y; int i; + cairo_status_t status; src = _cairo_xcb_picture_for_pattern (dst, pattern, extents); - if (unlikely (src->base.status)) - return src->base.status; + status = _cairo_surface_status (&src->base); + if (unlikely (status)) + return status; if (info->antialias == CAIRO_ANTIALIAS_NONE) format = CAIRO_FORMAT_A1; @@ -1686,7 +1688,7 @@ _create_composite_mask (cairo_clip_t *clip, surface = (cairo_xcb_surface_t *) _cairo_xcb_surface_create_similar (dst, CAIRO_CONTENT_ALPHA, extents->width, extents->height); - if (unlikely (surface->base.status)) + if (unlikely (_cairo_surface_status (&surface->base))) return surface; _cairo_xcb_surface_ensure_picture (surface); @@ -1749,16 +1751,19 @@ _clip_and_composite_with_mask (cairo_clip_t *clip, { cairo_xcb_surface_t *mask; cairo_xcb_picture_t *src; + cairo_status_t status; mask = _create_composite_mask (clip, draw_func, draw_closure, dst, extents); - if (unlikely (mask->base.status)) - return mask->base.status; + status = _cairo_surface_status (&mask->base); + if (unlikely (status)) + return status; if (pattern != NULL || dst->base.content != CAIRO_CONTENT_ALPHA) { src = _cairo_xcb_picture_for_pattern (dst, pattern, extents); - if (unlikely (src->base.status)) { + status = _cairo_surface_status (&src->base); + if (unlikely (status)) { cairo_surface_destroy (&mask->base); - return src->base.status; + return status; } _cairo_xcb_connection_render_composite (dst->connection, @@ -1809,8 +1814,9 @@ _clip_and_composite_combine (cairo_clip_t *clip, tmp = (cairo_xcb_surface_t *) _cairo_xcb_surface_create_similar (dst, dst->base.content, extents->width, extents->height); - if (unlikely (tmp->base.status)) - return tmp->base.status; + status = _cairo_surface_status (&tmp->base); + if (unlikely (status)) + return status; _cairo_xcb_surface_ensure_picture (tmp); @@ -1862,7 +1868,8 @@ _clip_and_composite_combine (cairo_clip_t *clip, goto CLEANUP_SURFACE; clip_surface = _cairo_clip_get_surface (clip, &dst->base, &clip_x, &clip_y); - if (unlikely (clip_surface->status)) + status = _cairo_surface_status (clip_surface); + if (unlikely (status)) goto CLEANUP_SURFACE; clip_picture = ((cairo_xcb_surface_t *) clip_surface)->picture; @@ -1917,16 +1924,19 @@ _clip_and_composite_source (cairo_clip_t *clip, { cairo_xcb_surface_t *mask; cairo_xcb_picture_t *src; + cairo_status_t status; /* Create a surface that is mask IN clip */ mask = _create_composite_mask (clip, draw_func, draw_closure, dst, extents); - if (unlikely (mask->base.status)) - return mask->base.status; + status = _cairo_surface_status (&mask->base); + if (unlikely (status)) + return status; src = _cairo_xcb_picture_for_pattern (dst, pattern, extents); - if (unlikely (src->base.status)) { + status = _cairo_surface_status (&src->base); + if (unlikely (status)) { cairo_surface_destroy (&mask->base); - return src->base.status; + return status; } if (dst->base.is_clear) { @@ -2063,10 +2073,12 @@ _cairo_xcb_surface_fixup_unbounded (cairo_xcb_surface_t *dst, } else { int i; cairo_xcb_picture_t *src; + cairo_status_t status; src = _cairo_xcb_transparent_picture (dst); - if (unlikely (src->base.status)) - return src->base.status; + status = _cairo_surface_status (&src->base); + if (unlikely (status)) + return status; for (i = 0; i < n; i++) { _cairo_xcb_connection_render_composite (dst->connection, @@ -2090,10 +2102,12 @@ _cairo_xcb_surface_fixup_unbounded_with_mask (cairo_xcb_surface_t *dst, { cairo_xcb_surface_t *mask; int mask_x, mask_y; + cairo_status_t status; mask = (cairo_xcb_surface_t *) _cairo_clip_get_surface (clip, &dst->base, &mask_x, &mask_y); - if (unlikely (mask->base.status)) - return mask->base.status; + status = _cairo_surface_status (&mask->base); + if (unlikely (status)) + return status; /* top */ if (rects->bounded.y != rects->unbounded.y) { @@ -2495,8 +2509,9 @@ _composite_boxes (cairo_xcb_surface_t *dst, int clip_x, clip_y; clip_surface = _cairo_clip_get_surface (clip, &dst->base, &clip_x, &clip_y); - if (unlikely (clip_surface->status)) - return clip_surface->status; + status = _cairo_surface_status (clip_surface); + if (unlikely (status)) + return status; _cairo_pattern_init_for_surface (&mask, clip_surface); mask.base.filter = CAIRO_FILTER_NEAREST; @@ -2813,16 +2828,19 @@ _composite_mask (void *closure, { const cairo_pattern_t *mask_pattern = closure; cairo_xcb_picture_t *src, *mask = NULL; + cairo_status_t status; if (src_pattern != NULL) { src = _cairo_xcb_picture_for_pattern (dst, src_pattern, extents); - if (unlikely (src->base.status)) - return src->base.status; + status = _cairo_surface_status (&src->base); + if (unlikely (status)) + return status; mask = _cairo_xcb_picture_for_pattern (dst, mask_pattern, extents); - if (unlikely (mask->base.status)) { + status = _cairo_surface_status (&mask->base); + if (unlikely (status)) { cairo_surface_destroy (&src->base); - return mask->base.status; + return status; } _cairo_xcb_connection_render_composite (dst->connection, @@ -2838,8 +2856,9 @@ _composite_mask (void *closure, cairo_surface_destroy (&src->base); } else { src = _cairo_xcb_picture_for_pattern (dst, mask_pattern, extents); - if (unlikely (src->base.status)) - return src->base.status; + status = _cairo_surface_status (&src->base); + if (unlikely (status)) + return status; _cairo_xcb_connection_render_composite (dst->connection, _render_operator (op), @@ -3180,8 +3199,9 @@ _cairo_xcb_surface_render_stroke_via_mask (cairo_xcb_surface_t *dst, image = _cairo_xcb_surface_create_similar_image (dst, CAIRO_CONTENT_ALPHA, extents->bounded.width, extents->bounded.height); - if (unlikely (image->status)) - return image->status; + status = _cairo_surface_status (image); + if (unlikely (status)) + return status; _clear_image (image); @@ -3365,8 +3385,9 @@ _cairo_xcb_surface_render_fill_via_mask (cairo_xcb_surface_t *dst, CAIRO_CONTENT_ALPHA, extents->bounded.width, extents->bounded.height); - if (unlikely (image->status)) - return image->status; + status = _cairo_surface_status (image); + if (unlikely (status)) + return status; _clear_image (image); @@ -3513,8 +3534,9 @@ _cairo_xcb_surface_render_glyphs_via_mask (cairo_xcb_surface_t *dst, image = _cairo_xcb_surface_create_similar_image (dst, content, extents->bounded.width, extents->bounded.height); - if (unlikely (image->status)) - return image->status; + status = _cairo_surface_status (image); + if (unlikely (status)) + return status; _clear_image (image); @@ -4015,7 +4037,7 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection, cairo_surface_t *tmp_surface; tmp_surface = cairo_image_surface_create (glyphset_info->format, 1, 1); - status = tmp_surface->status; + status = _cairo_surface_status (tmp_surface); if (unlikely (status)) goto BAIL; @@ -4032,7 +4054,7 @@ _cairo_xcb_surface_add_glyph (cairo_xcb_connection_t *connection, if (glyph_surface->format != glyphset_info->format) { glyph_surface = _cairo_image_surface_coerce_to_format (glyph_surface, glyphset_info->format); - status = glyph_surface->base.status; + status = _cairo_surface_status (&glyph_surface->base); if (unlikely (status)) goto BAIL; } @@ -4249,8 +4271,9 @@ _composite_glyphs (void *closure, int i; src = _cairo_xcb_picture_for_pattern (dst, pattern, extents); - if (unlikely (src->base.status)) - return src->base.status; + status = _cairo_surface_status (&src->base); + if (unlikely (status)) + return status; memset (glyph_cache, 0, sizeof (glyph_cache)); |