[cairo-commit] 2 commits - src/cairo-surface.c src/cairo-xcb-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Jan 25 10:22:50 PST 2010
src/cairo-surface.c | 21 ++++++++++++++++++++-
src/cairo-xcb-surface.c | 2 ++
2 files changed, 22 insertions(+), 1 deletion(-)
New commits:
commit 571ab1007571cb8d78fcb5206b43d6b964aa0df1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jan 25 18:22:03 2010 +0000
xcb: Fix linking with xcb-drm
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index c61ddb3..5008fe7 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -259,6 +259,7 @@ _cairo_xcb_surface_finish (void *abstract_surface)
cairo_list_del (&surface->link);
+#if CAIRO_HAS_DRM_SURFACE && CAIRO_HAS_XCB_DRM_FUNCTIONS
if (surface->drm != NULL) {
cairo_surface_finish (surface->drm);
cairo_surface_destroy (surface->drm);
@@ -266,6 +267,7 @@ _cairo_xcb_surface_finish (void *abstract_surface)
xcb_dri2_destroy_drawable (surface->connection->xcb_connection,
surface->drawable);
}
+#endif
status = _cairo_xcb_connection_acquire (surface->connection);
if (status == CAIRO_STATUS_SUCCESS) {
commit ecda633f887a10da650b4cd3efb17c861a6f519f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jan 25 18:17:28 2010 +0000
mime-data: Detach existing alternate representations upon modification
A major sore point in the current mime-data API is the choice to keep
the alternate mime-data representations after the user has actually
modifying the primary representation (i.e. has made it a target of a
cairo_t and drawn to it). This has been rightly chastised as unexpected
behaviour, and given that we already have the mechanism to detach
snapshots upon modification, there is no reason not to behave as
expected.
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 1f438e8..f4410f0 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -263,6 +263,22 @@ _cairo_surface_detach_snapshots (cairo_surface_t *surface)
assert (! _cairo_surface_has_snapshots (surface));
}
+static cairo_bool_t
+_cairo_surface_has_mime_data (cairo_surface_t *surface)
+{
+ return surface->mime_data.num_elements != 0;
+}
+
+static void
+_cairo_surface_detach_mime_data (cairo_surface_t *surface)
+{
+ if (! _cairo_surface_has_mime_data (surface))
+ return;
+
+ _cairo_user_data_array_init (&surface->mime_data);
+ _cairo_user_data_array_fini (&surface->mime_data);
+}
+
cairo_status_t
_cairo_surface_attach_snapshot (cairo_surface_t *surface,
cairo_surface_t *snapshot,
@@ -338,7 +354,8 @@ _cairo_surface_is_writable (cairo_surface_t *surface)
{
return ! surface->finished &&
surface->snapshot_of == NULL &&
- ! _cairo_surface_has_snapshots (surface);
+ ! _cairo_surface_has_snapshots (surface) &&
+ ! _cairo_surface_has_mime_data (surface);
}
static void
@@ -349,6 +366,7 @@ _cairo_surface_begin_modification (cairo_surface_t *surface)
assert (surface->snapshot_of == NULL);
_cairo_surface_detach_snapshots (surface);
+ _cairo_surface_detach_mime_data (surface);
}
void
@@ -1059,6 +1077,7 @@ cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
* modifying the surface independently of cairo (and thus having to
* call mark_dirty()). */
assert (! _cairo_surface_has_snapshots (surface));
+ assert (! _cairo_surface_has_mime_data (surface));
surface->is_clear = FALSE;
More information about the cairo-commit
mailing list