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); } } }
cairo_status_t _cairo_clip_init_deep_copy (cairo_clip_t *clip, cairo_clip_t *other, cairo_surface_t *target) { cairo_status_t status; _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->has_region) { status = _cairo_region_copy (&clip->region, &other->region); if (unlikely (status)) goto BAIL; clip->has_region = TRUE; } if (other->surface) { int dx, dy; status = _cairo_surface_clone_similar (target, other->surface, 0, 0, other->surface_rect.width, other->surface_rect.height, &dx, &dy, &clip->surface); if (unlikely (status)) goto BAIL; clip->surface_rect = other->surface_rect; /* src offset was 0, so we expect an exact replica of the surface */ assert (dx == 0); assert (dy == 0); } if (other->path) { status = _cairo_clip_path_reapply_clip_path (clip, other->path); if (_cairo_status_is_error (status)) goto BAIL; } } return CAIRO_STATUS_SUCCESS; BAIL: if (clip->has_region) _cairo_region_fini (&clip->region); if (clip->surface) cairo_surface_destroy (clip->surface); return status; }
static void _cairo_clip_path_reapply_clip_path (cairo_clip_t *clip, cairo_clip_path_t *clip_path) { if (clip_path->prev) _cairo_clip_path_reapply_clip_path (clip, clip_path->prev); _cairo_clip_intersect_path (clip, &clip_path->path, clip_path->fill_rule, clip_path->tolerance, clip_path->antialias); }
cairo_status_t _cairo_clip_init_deep_copy (cairo_clip_t *clip, cairo_clip_t *other, cairo_surface_t *target) { cairo_status_t status; _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->has_region) { status = _cairo_region_copy (&clip->region, &other->region); if (status) goto BAIL; clip->has_region = TRUE; } if (other->surface) { status = _cairo_surface_clone_similar (target, other->surface, other->surface_rect.x, other->surface_rect.y, other->surface_rect.width, other->surface_rect.height, &clip->surface); if (status) goto BAIL; clip->surface_rect = other->surface_rect; } if (other->path) { status = _cairo_clip_path_reapply_clip_path (clip, other->path); if (status && status != CAIRO_INT_STATUS_UNSUPPORTED) goto BAIL; } } return CAIRO_STATUS_SUCCESS; BAIL: if (clip->has_region) _cairo_region_fini (&clip->region); if (clip->surface) cairo_surface_destroy (clip->surface); return status; }
static cairo_status_t _cairo_clip_path_reapply_clip_path (cairo_clip_t *clip, cairo_clip_path_t *clip_path) { cairo_status_t status; if (clip_path->prev) { status = _cairo_clip_path_reapply_clip_path (clip, clip_path->prev); if (status && status != CAIRO_INT_STATUS_UNSUPPORTED) return status; } return _cairo_clip_intersect_path (clip, &clip_path->path, clip_path->fill_rule, clip_path->tolerance, clip_path->antialias); }
static cairo_status_t _cairo_clip_path_reapply_clip_path (cairo_clip_t *clip, cairo_clip_path_t *clip_path) { cairo_status_t status; if (clip_path->prev) { status = _cairo_clip_path_reapply_clip_path (clip, clip_path->prev); if (_cairo_status_is_error (status)) return status; } return _cairo_clip_intersect_path (clip, &clip_path->path, clip_path->fill_rule, clip_path->tolerance, clip_path->antialias); }