mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 04:08:13 +02:00
[surface] Check for a NULL snapshot
The backend is permitted to return a NULL surface when snapshotting to indicate that it cannot (or choses not to) implement the method.
This commit is contained in:
parent
2e8ce34454
commit
2a2a19457b
1 changed files with 13 additions and 11 deletions
|
|
@ -1633,19 +1633,21 @@ _cairo_surface_snapshot (cairo_surface_t *surface)
|
|||
|
||||
if (surface->backend->snapshot != NULL) {
|
||||
snapshot = surface->backend->snapshot (surface);
|
||||
if (unlikely (snapshot->status))
|
||||
return snapshot;
|
||||
if (snapshot != NULL) {
|
||||
if (unlikely (snapshot->status))
|
||||
return snapshot;
|
||||
|
||||
/* Is this surface just a proxy - e.g. paginated surfaces? */
|
||||
if (snapshot->backend != surface->backend) {
|
||||
cairo_surface_t *previous;
|
||||
/* Is this surface just a proxy - e.g. paginated surfaces? */
|
||||
if (snapshot->backend != surface->backend) {
|
||||
cairo_surface_t *previous;
|
||||
|
||||
previous = _cairo_surface_has_snapshot (surface,
|
||||
snapshot->backend,
|
||||
snapshot->content);
|
||||
if (previous != NULL) {
|
||||
cairo_surface_destroy (snapshot);
|
||||
return cairo_surface_reference (previous);
|
||||
previous = _cairo_surface_has_snapshot (surface,
|
||||
snapshot->backend,
|
||||
snapshot->content);
|
||||
if (previous != NULL) {
|
||||
cairo_surface_destroy (snapshot);
|
||||
return cairo_surface_reference (previous);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue