summaryrefslogtreecommitdiff
path: root/src/cairo-surface-private.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-05-26 21:07:07 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-06-02 15:13:47 +0100
commitcffb398f5a484000be458d04ef8f8bce3f6c7e3d (patch)
tree3b620279d063b567389a24b8533b6c1801dec673 /src/cairo-surface-private.h
parent7ed050fd435f17d25c7b757b02cfe200f8779fc2 (diff)
downloadcairo-cffb398f5a484000be458d04ef8f8bce3f6c7e3d.tar.gz
Add a generic cow-snapshotting framework
Provide a mechanism for backends to attach and remove snapshots. This can be used by backends to provide a cache for _cairo_surface_clone_similar(), or by the meta-surfaces to only emit a single pattern for each unique snapshot. In order to prevent stale data being returned upon a snapshot operation, if the surface is modified (via the 5 high level operations, and on notification of external modification) we break the association with any current snapshot of the surface and thus preserve the current data for their use.
Diffstat (limited to 'src/cairo-surface-private.h')
-rw-r--r--src/cairo-surface-private.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cairo-surface-private.h b/src/cairo-surface-private.h
index b07f7806d..c25b6dc8a 100644
--- a/src/cairo-surface-private.h
+++ b/src/cairo-surface-private.h
@@ -43,6 +43,8 @@
#include "cairo-types-private.h"
#include "cairo-reference-count-private.h"
+typedef void (*cairo_surface_func_t) (cairo_surface_t *);
+
struct _cairo_surface {
const cairo_surface_backend_t *backend;
@@ -94,7 +96,10 @@ struct _cairo_surface {
unsigned int current_clip_serial;
/* A "snapshot" surface is immutable. See _cairo_surface_snapshot. */
- cairo_bool_t is_snapshot;
+ cairo_surface_t *snapshot_of;
+ cairo_surface_func_t snapshot_detach;
+ /* current snapshots of this surface */
+ cairo_array_t snapshots;
/*
* Surface font options, falling back to backend's default options,