[cairo-commit] [cairo-www] src/threaded_animation_with_cairo.mdwn

Carl Worth cworth at freedesktop.org
Thu Jan 17 18:26:50 PST 2008


 src/threaded_animation_with_cairo.mdwn |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit 5860bbedde728ad6f4192d4a0cc92092766745af
Author: Carl Worth <cworth at freedesktop.org>
Date:   Thu Jan 17 18:26:50 2008 -0800

    web commit by Albert

diff --git a/src/threaded_animation_with_cairo.mdwn b/src/threaded_animation_with_cairo.mdwn
new file mode 100644
index 0000000..19b3efb
--- /dev/null
+++ b/src/threaded_animation_with_cairo.mdwn
@@ -0,0 +1,7 @@
+#Multi-threaded Animation with Cairo and GTK+
+
+Complex animations with cairo and GTK+ can result in a laggy interface.  This is because the `gtk_main()` thread runs in a single loop.  So, if your `do_draw()` function implements a complicated drawing command, and it is called from the `gtk_main()` thread (say by an `on_window_expose_event()` function), the rest of your gtk code will be blocked until the `do_draw()` function finishes.  Consequentially, menu items, mouse clicks, and even close button events will be slow to be processed and your interface will feel laggy.
+
+One solution is to hand off all the processor-intensive drawing to a separate thread, thus freeing the `gtk_main()` thread to respond to events.
+
+This tutorial will show you how to safely implement multi-threaded c code to draw a processor intensive animation to a `gtk_window`.
\ No newline at end of file


More information about the cairo-commit mailing list