cairo-trace: Fix mark-dirty with xcb backend

cairo-xcb's acquire_source_image implementation will attach the image it returns
as a snapshot to the xcb surface. cairo_surface_mark_dirty_rectangle asserts
that the surface doesn't have any snapshots attached. cairo-trace will emit the
surface to the trace when it was marked dirty by drawing it to an image surface.

The combination of these three things caused a failed assertion when cairo-trace
was used on something which uses xcb/Xlib and which uses mark_dirty.
I found this with firefox and xlib-xcb.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2011-07-16 16:47:30 +02:00
parent 27692ca759
commit 0dc63f5bb4

View file

@ -3584,6 +3584,12 @@ cairo_surface_mark_dirty (cairo_surface_t *surface)
{
_enter_trace ();
_emit_line_info ();
/* Call cairo before emitting the trace since _emit_surface() might cause
* snapshots to be creates while mark_dirty assert()s that there are none.
*/
DLCALL (cairo_surface_mark_dirty, surface);
if (surface != NULL && _write_lock ()) {
if (_mark_dirty) {
_emit_surface (surface);
@ -3593,8 +3599,6 @@ cairo_surface_mark_dirty (cairo_surface_t *surface)
_trace_printf ("%% s%ld mark-dirty\n", _get_surface_id (surface));
_write_unlock ();
}
DLCALL (cairo_surface_mark_dirty, surface);
_exit_trace ();
}
@ -3603,6 +3607,12 @@ cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
int x, int y, int width, int height)
{
_enter_trace ();
/* Call cairo before emitting the trace since _emit_surface() might cause
* snapshots to be creates while mark_dirty assert()s that there are none.
*/
DLCALL (cairo_surface_mark_dirty_rectangle, surface, x, y, width, height);
_emit_line_info ();
if (surface != NULL && _write_lock ()) {
if (_mark_dirty) {
@ -3615,8 +3625,6 @@ cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
_get_surface_id (surface), x, y, width, height);
_write_unlock ();
}
DLCALL (cairo_surface_mark_dirty_rectangle, surface, x, y, width, height);
_exit_trace ();
}