[cairo-commit] 3 commits - src/cairo-device.c test/xcb-surface-source.image16.ref.png test/xcb-surface-source.ps.argb32.ref.png test/xcb-surface-source.ps.rgb24.ref.png test/xlib-surface-source.ps2.ref.png test/xlib-surface-source.ps3.ref.png test/xlib-surface-source.ps.argb32.ref.png test/xlib-surface-source.ps.rgb24.ref.png

Uli Schlachter psychon at kemper.freedesktop.org
Thu Feb 10 08:17:53 PST 2011


 dev/null                                   |binary
 src/cairo-device.c                         |    8 ++++++--
 test/xcb-surface-source.image16.ref.png    |binary
 test/xcb-surface-source.ps.argb32.ref.png  |binary
 test/xcb-surface-source.ps.rgb24.ref.png   |binary
 test/xlib-surface-source.ps.argb32.ref.png |binary
 test/xlib-surface-source.ps.rgb24.ref.png  |binary
 7 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit ae669fb8aba1b2437d10c08e36c5ff593397626d
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Feb 9 19:41:03 2011 +0100

    Finish devices after their finish callback returns
    
    The problem is that the finish callback might still have to work with the
    device, so it can't be made unusable yet. This is in contrast to what
    cairo_surface_finish() does, but when finishing a surface it's quite unlikely
    that its cairo_surface_t still has to be passed around to functions outside of
    the backend.
    
    This "fixes" some problems with the xcb-surface-source test where
    _cairo_surface_snapshot()-style snapshots break when the underlying
    cairo_device_t is finished. (In the following backtrace, cairo_device_acquire
    fails because the device's ->finished member is already TRUE)
    
     #0  cairo_device_acquire (device=0x690f70) at cairo-device.c:414
     #1  0x00007ffff7b884fb in _cairo_xcb_connection_acquire (surface=0x69c610, use_shm=<value optimized out>, image_out=0x7fffffffcc58) at cairo-xcb-private.h:246
     #2  _get_image (surface=0x69c610, use_shm=<value optimized out>, image_out=0x7fffffffcc58) at cairo-xcb-surface.c:425
     #3  0x00007ffff7b893cf in _cairo_xcb_surface_acquire_source_image (abstract_surface=0x69c610, image_out=0x7fffffffcce8, image_extra=0x7fffffffcce0)
         at cairo-xcb-surface.c:561
     #4  0x00007ffff7b601d4 in _cairo_surface_acquire_source_image (surface=0x690f70, image_out=0x7fffffffcce8, image_extra=0x0) at cairo-surface.c:1458
     #5  0x00007ffff7b65dcf in _cairo_surface_snapshot_copy_on_write (surface=<value optimized out>) at cairo-surface-snapshot.c:125
     #6  0x00007ffff7b609b1 in _cairo_surface_detach_snapshot (snapshot=0x690f70) at cairo-surface.c:330
     #7  0x00007ffff7b606dc in _cairo_surface_detach_snapshots (surface=0x69c610) at cairo-surface.c:315
     #8  cairo_surface_flush (surface=0x69c610) at cairo-surface.c:1126
     #9  0x00007ffff7b6074d in cairo_surface_finish (surface=0x690f70) at cairo-surface.c:718
     #10 0x00007ffff7b881ff in _cairo_xcb_screen_finish (screen=0x691920) at cairo-xcb-screen.c:61
     #11 0x00007ffff7b8629c in _device_finish (device=0x690f70) at cairo-xcb-connection.c:546
     #12 0x0000000000446f7c in cleanup (data=0x69c370) at xcb-surface-source.c:47
     #13 0x00007ffff7b1e56a in _cairo_user_data_array_fini (array=0x693628) at cairo-array.c:390
     #14 0x00007ffff7b60868 in cairo_surface_destroy (surface=0x693600) at cairo-surface.c:651
     #15 0x0000000000447599 in draw (cr=0x7ffff7ddc288, width=<value optimized out>, height=<value optimized out>) at surface-source.c:149
     #16 0x000000000040c1c3 in cairo_test_for_target (ctx=0x7fffffffe640, target=0x669668, dev_offset=<value optimized out>, similar=<value optimized out>)
         at cairo-test.c:984
     #17 0x000000000040d997 in _cairo_test_context_run_for_target (ctx=<value optimized out>, target=<value optimized out>, similar=<value optimized out>,
         dev_offset=<value optimized out>) at cairo-test.c:1617
     #18 0x000000000040ee09 in _cairo_test_runner_draw (argc=<value optimized out>, argv=<value optimized out>) at cairo-test-runner.c:269
     #19 main (argc=<value optimized out>, argv=<value optimized out>) at cairo-test-runner.c:924
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-device.c b/src/cairo-device.c
index a32b971..4be30b4 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -296,10 +296,14 @@ cairo_device_finish (cairo_device_t *device)
 
     cairo_device_flush (device);
 
-    device->finished = TRUE;
-
     if (device->backend->finish != NULL)
 	device->backend->finish (device);
+
+    /* We only finish the device after the backend's callback returns because
+     * the device might still be needed during the callback
+     * (e.g. for cairo_device_acquire ()).
+     */
+    device->finished = TRUE;
 }
 slim_hidden_def (cairo_device_finish);
 
commit 070bc5dd891ba698aeb3eaa899f662d4123f6928
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Feb 9 20:08:28 2011 +0100

    xcb-surface-source: Add image16 and ps ref images
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/test/xcb-surface-source.image16.ref.png b/test/xcb-surface-source.image16.ref.png
new file mode 100644
index 0000000..2a7460e
Binary files /dev/null and b/test/xcb-surface-source.image16.ref.png differ
diff --git a/test/xcb-surface-source.ps.argb32.ref.png b/test/xcb-surface-source.ps.argb32.ref.png
new file mode 100644
index 0000000..910f895
Binary files /dev/null and b/test/xcb-surface-source.ps.argb32.ref.png differ
diff --git a/test/xcb-surface-source.ps.rgb24.ref.png b/test/xcb-surface-source.ps.rgb24.ref.png
new file mode 100644
index 0000000..636b0f5
Binary files /dev/null and b/test/xcb-surface-source.ps.rgb24.ref.png differ
commit 6825007ac6d46e8d8a7a3bc065453af5d6e755a8
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Feb 9 19:58:05 2011 +0100

    ps: Update xlib-surface-source ref images
    
    Since 9948b5180a, the *-surface-source tests draw a different image (a
    translucent region was added). However, the ref images for xlib-surface-source
    with cairo-ps weren't updated and thus the test failed.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/test/xlib-surface-source.ps.argb32.ref.png b/test/xlib-surface-source.ps.argb32.ref.png
new file mode 100644
index 0000000..910f895
Binary files /dev/null and b/test/xlib-surface-source.ps.argb32.ref.png differ
diff --git a/test/xlib-surface-source.ps.rgb24.ref.png b/test/xlib-surface-source.ps.rgb24.ref.png
new file mode 100644
index 0000000..636b0f5
Binary files /dev/null and b/test/xlib-surface-source.ps.rgb24.ref.png differ
diff --git a/test/xlib-surface-source.ps2.ref.png b/test/xlib-surface-source.ps2.ref.png
deleted file mode 100644
index 1023158..0000000
Binary files a/test/xlib-surface-source.ps2.ref.png and /dev/null differ
diff --git a/test/xlib-surface-source.ps3.ref.png b/test/xlib-surface-source.ps3.ref.png
deleted file mode 100644
index 1023158..0000000
Binary files a/test/xlib-surface-source.ps3.ref.png and /dev/null differ


More information about the cairo-commit mailing list