changeset 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 fb79175e6cc3
children dbea3e42bf93
files include/mb_graph_engine_cairo.h src/graph_engine_cairo.c
diffstat 2 files changed, 17 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/include/mb_graph_engine_cairo.h	Sun Dec 05 12:23:29 2010 +0800
+++ b/include/mb_graph_engine_cairo.h	Sun Dec 05 13:37:13 2010 +0800
@@ -93,6 +93,7 @@
 						int stop_cnt);
 extern mbe_pattern_t *mbe_pattern_create_image(mb_img_data_t *img);
 extern void mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas);
+extern void mbe_copy_source(mbe_t *src, mbe_t *dst);
 
 
 static void mbe_pattern_set_matrix(mbe_pattern_t *ptn,
@@ -112,21 +113,6 @@
     cairo_set_operator(canvas, old_op);
 }
 
-static 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(src, 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);
-}
-
 static mbe_scaled_font_t *
 mbe_scaled_font_create(mbe_font_face_t *face, co_aix fnt_mtx[6],
 		       co_aix ctm[6]) {
--- 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);
+}