mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 11:28:02 +02:00
snapshot: Attach the backend generated snapshot to the target
Cache the result of snapshotting using the backend vfunc in the normal manner by attaching the snapshot to the target. This should reduce resource usage in these cases.
This commit is contained in:
parent
07122f37d1
commit
ab2776c9a1
1 changed files with 20 additions and 1 deletions
|
|
@ -196,9 +196,28 @@ _cairo_surface_snapshot (cairo_surface_t *surface)
|
|||
if (surface->backend->snapshot != NULL) {
|
||||
cairo_surface_t *snap;
|
||||
|
||||
snap = surface->backend->snapshot (surface);
|
||||
snap = _cairo_surface_has_snapshot (surface, surface->backend);
|
||||
if (snap != NULL)
|
||||
return cairo_surface_reference (snap);
|
||||
|
||||
snap = surface->backend->snapshot (surface);
|
||||
if (snap != NULL) {
|
||||
if (unlikely (snap->status))
|
||||
return snap;
|
||||
|
||||
status = _cairo_surface_copy_mime_data (snap, surface);
|
||||
if (unlikely (status)) {
|
||||
cairo_surface_destroy (snap);
|
||||
return _cairo_surface_create_in_error (status);
|
||||
}
|
||||
|
||||
snap->device_transform = surface->device_transform;
|
||||
snap->device_transform_inverse = surface->device_transform_inverse;
|
||||
|
||||
_cairo_surface_attach_snapshot (surface, snap, NULL);
|
||||
|
||||
return snap;
|
||||
}
|
||||
}
|
||||
|
||||
snapshot = (cairo_surface_snapshot_t *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue