gfxTeeSurface::gfxTeeSurface(gfxASurface **aSurfaces, int32_t aSurfaceCount) { NS_ASSERTION(aSurfaceCount > 0, "Must have a least one surface"); cairo_surface_t *csurf = cairo_tee_surface_create(aSurfaces[0]->CairoSurface()); Init(csurf, false); for (int32_t i = 1; i < aSurfaceCount; ++i) { cairo_tee_surface_add(csurf, aSurfaces[i]->CairoSurface()); } }
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; }