void _cairo_clip_init_deep_copy (cairo_clip_t *clip, cairo_clip_t *other, cairo_surface_t *target) { _cairo_clip_init (clip, target); if (other->mode != clip->mode) { /* We should reapply the original clip path in this case, and let * whatever the right handling is happen */ } else { if (other->region) { clip->region = pixman_region_create (); pixman_region_copy (clip->region, other->region); } if (other->surface) { _cairo_surface_clone_similar (target, other->surface, &clip->surface); clip->surface_rect = other->surface_rect; } if (other->path) { _cairo_clip_path_reapply_clip_path (clip, other->path); } } }
int pixman_image_set_clip_region (pixman_image_t *image, pixman_region16_t *region) { pixman_image_destroyClip (image); if (region) { image->clientClip = pixman_region_create (); pixman_region_copy (image->clientClip, region); image->clientClipType = CT_REGION; } if (image->freeCompClip) pixman_region_destroy (image->pCompositeClip); image->pCompositeClip = pixman_region_create(); pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip, 0, 0, image->pixels->width, image->pixels->height); image->freeCompClip = 1; if (region) { pixman_region_translate (image->pCompositeClip, - image->clipOrigin.x, - image->clipOrigin.y); pixman_region_intersect (image->pCompositeClip, image->pCompositeClip, region); pixman_region_translate (image->pCompositeClip, image->clipOrigin.x, image->clipOrigin.y); } image->stateChanges |= CPClipMask; return 0; }
static cairo_int_status_t _cairo_quartz_surface_set_clip_region(void *abstract_surface, pixman_region16_t * region) { cairo_quartz_surface_t *surface = abstract_surface; if (surface->clip_region) pixman_region_destroy (surface->clip_region); if (region) { surface->clip_region = pixman_region_create (); pixman_region_copy (surface->clip_region, region); } else surface->clip_region = NULL; return CAIRO_STATUS_SUCCESS; }
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); }