mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-02 20:30:17 +01:00
[surface] Move the meta-data copy-on-snapshot to the generic layer.
As pointed out by Paolo Bonzini, copying the meta data for a snapshot is common for all backends and so should be handled by the generic layer.
This commit is contained in:
parent
adaf70a93f
commit
cc8a09567c
2 changed files with 27 additions and 14 deletions
|
|
@ -1152,17 +1152,6 @@ _cairo_surface_fallback_snapshot (cairo_surface_t *surface)
|
|||
return _cairo_surface_create_in_error (status);
|
||||
}
|
||||
|
||||
status = _cairo_surface_copy_mime_data (snapshot, surface);
|
||||
if (unlikely (status)) {
|
||||
cairo_surface_destroy (snapshot);
|
||||
return _cairo_surface_create_in_error (status);
|
||||
}
|
||||
|
||||
snapshot->device_transform = surface->device_transform;
|
||||
snapshot->device_transform_inverse = surface->device_transform_inverse;
|
||||
|
||||
snapshot->is_snapshot = TRUE;
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1399,16 +1399,40 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
|
|||
cairo_surface_t *
|
||||
_cairo_surface_snapshot (cairo_surface_t *surface)
|
||||
{
|
||||
cairo_surface_t *snapshot;
|
||||
cairo_status_t status;
|
||||
|
||||
if (surface->status)
|
||||
return _cairo_surface_create_in_error (surface->status);
|
||||
|
||||
if (surface->finished)
|
||||
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
|
||||
|
||||
if (surface->backend->snapshot)
|
||||
return surface->backend->snapshot (surface);
|
||||
if (surface->is_snapshot)
|
||||
return cairo_surface_reference (surface);
|
||||
|
||||
return _cairo_surface_fallback_snapshot (surface);
|
||||
snapshot = NULL;
|
||||
if (surface->backend->snapshot != NULL)
|
||||
snapshot = surface->backend->snapshot (surface);
|
||||
|
||||
if (snapshot == NULL)
|
||||
snapshot = _cairo_surface_fallback_snapshot (surface);
|
||||
|
||||
if (unlikely (snapshot->status))
|
||||
return snapshot;
|
||||
|
||||
status = _cairo_surface_copy_mime_data (snapshot, surface);
|
||||
if (unlikely (status)) {
|
||||
cairo_surface_destroy (snapshot);
|
||||
return _cairo_surface_create_in_error (status);
|
||||
}
|
||||
|
||||
snapshot->device_transform = surface->device_transform;
|
||||
snapshot->device_transform_inverse = surface->device_transform_inverse;
|
||||
|
||||
snapshot->is_snapshot = TRUE;
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue