Beispiel #1
0
static cairo_status_t
_cairo_image_surface_reset (void *abstract_surface)
{
    cairo_image_surface_t *surface = abstract_surface;
    cairo_status_t status;

    status = _cairo_image_surface_set_clip_region (surface, NULL);
    assert (status == CAIRO_STATUS_SUCCESS);

    return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_test_paginated_surface_set_clip_region (void *abstract_surface,
					 cairo_region_t *region)
{
    test_paginated_surface_t *surface = abstract_surface;

    if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
	return CAIRO_STATUS_SUCCESS;

    /* XXX: The whole surface backend clipping interface is a giant
     * disaster right now. In particular, its uncleanness shows up
     * when trying to implement one surface that wraps another one (as
     * we are doing here).
     *
     * Here are two of the problems that show up:
     *
     * 1. The most critical piece of information in all this stuff,
     * the "clip" isn't getting passed to the backend
     * functions. Instead the generic surface layer is caching that as
     * surface->clip. This is a problem for surfaces like this one
     * that do wrapping. Our base surface will have the clip set, but
     * our target's surface will not.
     *
     * 2. We're here in our backend's set_clip_region function, and we
     * want to call into our target surface's set_clip_region.
     * Generally, we would do this by calling an equivalent
     * _cairo_surface function, but _cairo_surface_set_clip_region
     * does not have the same signature/semantics, (it has the
     * clip_serial stuff as well).
     *
     * We kludge around each of these by manually copying the clip
     * object from our base surface into the target's base surface
     * (yuck!) and by reaching directly into the image surface's
     * set_clip_region instead of calling into the generic
     * _cairo_surface_set_clip_region (double yuck!).
     */

    surface->target->clip = surface->base.clip;

    return _cairo_image_surface_set_clip_region (surface->target, region);
}