Exemplo n.º 1
0
static cairo_surface_t *
_cairo_tee_surface_create_similar (void			*abstract_surface,
				   cairo_content_t	 content,
				   int			 width,
				   int			 height)
{

    cairo_tee_surface_t *other = abstract_surface;
    cairo_surface_t *similar;
    cairo_surface_t *surface;
    cairo_surface_wrapper_t *slaves;
    int n, num_slaves;

    similar = _cairo_surface_wrapper_create_similar (&other->master,
						     content, width, height);
    surface = cairo_tee_surface_create (similar);
    cairo_surface_destroy (similar);
    if (unlikely (surface->status))
	return surface;

    num_slaves = _cairo_array_num_elements (&other->slaves);
    slaves = _cairo_array_index (&other->slaves, 0);
    for (n = 0; n < num_slaves; n++) {

	similar = _cairo_surface_wrapper_create_similar (&slaves[n],
							 content,
							 width, height);
	cairo_tee_surface_add (surface, similar);
	cairo_surface_destroy (similar);
    }

    if (unlikely (surface->status)) {
	cairo_status_t status = surface->status;
	cairo_surface_destroy (surface);
	surface = _cairo_surface_create_in_error (status);
    }

    return surface;
}
Exemplo n.º 2
0
static cairo_surface_t *
_test_wrapping_surface_create_similar (void		*abstract_surface,
				       cairo_content_t	 content,
				       int		 width,
				       int		 height)
{

    test_wrapping_surface_t *surface = abstract_surface;

    return _cairo_test_wrapping_surface_create (
	_cairo_surface_wrapper_create_similar (&surface->wrapper,
					       content, width, height));
}