Exemplo n.º 1
0
static cairo_int_status_t
_cairo_paginated_surface_copy_page (void *abstract_surface)
{
    cairo_status_t status;
    cairo_paginated_surface_t *surface = abstract_surface;

    status = _start_page (surface);
    if (status)
	return status;

    status = _paint_page (surface);
    if (status)
	return status;

    surface->page_num++;

    /* XXX: It might make sense to add some suport here for calling
     * cairo_surface_copy_page on the target surface. It would be an
     * optimization for the output, but the interaction with image
     * fallbacks gets tricky. For now, we just let the target see a
     * show_page and we implement the copying by simply not destroying
     * the meta-surface. */

    cairo_surface_show_page (surface->target);
    return cairo_surface_status (surface->target);
}
static cairo_int_status_t
_cairo_paginated_surface_show_page (void *abstract_surface)
{
    cairo_status_t status;
    cairo_paginated_surface_t *surface = abstract_surface;

    status = _start_page (surface);
    if (status)
	return status;

    status = _paint_page (surface);
    if (status)
	return status;

    status = _cairo_surface_show_page (surface->target);
    if (status)
	return status;

    if (cairo_surface_status (surface->meta))
	return cairo_surface_status (surface->meta);

    cairo_surface_destroy (surface->meta);

    surface->meta = _cairo_meta_surface_create (surface->content,
						surface->width, surface->height);
    if (cairo_surface_status (surface->meta))
	return cairo_surface_status (surface->meta);

    surface->page_num++;
    surface->page_is_blank = TRUE;

    return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_paginated_surface_show_page (void *abstract_surface)
{
    cairo_status_t status;
    cairo_paginated_surface_t *surface = abstract_surface;

    status = _start_page (surface);
    if (unlikely (status))
	return (cairo_int_status_t)status;

    status = (cairo_status_t)_paint_page (surface);
    if (unlikely (status))
	return (cairo_int_status_t)status;

    cairo_surface_show_page (surface->target);
    status = (cairo_status_t)surface->target->status;
    if (unlikely (status))
	return (cairo_int_status_t)status;

    status = (cairo_status_t)surface->recording_surface->status;
    if (unlikely (status))
	return (cairo_int_status_t)status;

    if (! surface->base.finished) {
	cairo_surface_destroy (surface->recording_surface);

	surface->recording_surface = _create_recording_surface_for_target (surface->target,
									   surface->content);
	status = (cairo_status_t)surface->recording_surface->status;
	if (unlikely (status))
	    return (cairo_int_status_t)status;

	surface->page_num++;
	surface->base.is_clear = TRUE;
    }

    return (cairo_int_status_t)CAIRO_STATUS_SUCCESS;
}