Пример #1
0
cairo_status_t
_cairo_clip_init_copy (cairo_clip_t *clip, cairo_clip_t *other)
{
    clip->mode = other->mode;

    clip->all_clipped = other->all_clipped;

    clip->surface = cairo_surface_reference (other->surface);
    clip->surface_rect = other->surface_rect;

    clip->serial = other->serial;

    _cairo_region_init (&clip->region);

    if (other->has_region) {
	cairo_status_t status;
	status = _cairo_region_copy (&clip->region, &other->region);
	if (status) {
	    _cairo_region_fini (&clip->region);
	    cairo_surface_destroy (clip->surface);
	    return status;
	}
        clip->has_region = TRUE;
    } else {
        clip->has_region = FALSE;
    }

    clip->path = _cairo_clip_path_reference (other->path);

    return CAIRO_STATUS_SUCCESS;
}
Пример #2
0
cairo_clip_t *
_cairo_clip_init_copy (cairo_clip_t *clip, cairo_clip_t *other)
{
    if (other != NULL) {
	clip->all_clipped = other->all_clipped;
	clip->path = _cairo_clip_path_reference (other->path);

	/* this guy is here because of the weird return semantics of _cairo_clip_init_copy */
	if (!other->path)
	    return NULL;
    } else {
	_cairo_clip_init (clip);
    }

    return clip;
}
Пример #3
0
void
_cairo_clip_init_copy (cairo_clip_t *clip, cairo_clip_t *other)
{
    clip->mode = other->mode;

    clip->surface = cairo_surface_reference (other->surface);
    clip->surface_rect = other->surface_rect;

    clip->serial = other->serial;

    if (other->region == NULL) {
	clip->region = other->region;
    } else {
	clip->region = pixman_region_create ();
	pixman_region_copy (clip->region, other->region);
    }

    clip->path = _cairo_clip_path_reference (other->path);
}