diff src/graph_engine_cairo.c @ 1101:e1a76d10953e

Fix black window output for Cairo graphic engine. The window is always black for Cairo graphic engine. it is caused by incorrect implementation of mbe_copy_source().
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 05 Dec 2010 13:37:13 +0800
parents d09f603438d8
children 851a062368bd
line wrap: on
line diff
--- a/src/graph_engine_cairo.c	Sun Dec 05 12:23:29 2010 +0800
+++ b/src/graph_engine_cairo.c	Sun Dec 05 13:37:13 2010 +0800
@@ -204,3 +204,19 @@
 
     cairo_clip(canvas);
 }
+
+void
+mbe_copy_source(mbe_t *src, mbe_t *dst) {
+    cairo_operator_t saved_op;
+    cairo_surface_t *surf;
+    cairo_pattern_t *ptn;
+
+    surf = cairo_get_target(src);
+    ptn = cairo_pattern_create_for_surface(surf);
+    cairo_set_source(dst, ptn);
+    cairo_pattern_destroy(ptn);
+    saved_op = cairo_get_operator(dst);
+    cairo_set_operator(dst, CAIRO_OPERATOR_SOURCE);
+    cairo_paint(dst);
+    cairo_set_operator(dst, saved_op);
+}