changeset 471:e98ae1407ca2 Android_Skia

Remove mbe_set_source_surface() from graphic engine. Since mbe_set_source() and mbe_pattern_create_for_surface() can replace mbe_set_source_surface(), mbe_set_source_surface() is removed to reduce number of functions in graphic engine layer.
author Thinker K.F. Li <thinker@branda.to>
date Thu, 12 Nov 2009 21:31:14 +0800
parents e54cd19cec28
children 4254eaa699d0
files include/mb_graph_engine_cairo.h src/X_main.c src/X_supp.c
diffstat 3 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/include/mb_graph_engine_cairo.h	Thu Nov 12 21:31:10 2009 +0800
+++ b/include/mb_graph_engine_cairo.h	Thu Nov 12 21:31:14 2009 +0800
@@ -27,7 +27,6 @@
 #define mbe_xlib_surface_create cairo_xlib_surface_create
 #define mbe_scaled_font_destroy cairo_scaled_font_destroy
 #define mbe_font_face_reference cairo_font_face_reference
-#define mbe_set_source_surface cairo_set_source_surface
 #define mbe_pattern_set_matrix cairo_pattern_set_matrix
 #define mbe_font_face_destroy cairo_font_face_destroy
 #define mbe_paint_with_alpha cairo_paint_with_alpha
--- a/src/X_main.c	Thu Nov 12 21:31:10 2009 +0800
+++ b/src/X_main.c	Thu Nov 12 21:31:14 2009 +0800
@@ -122,6 +122,7 @@
 void draw_path(mbe_t *cr, int w, int h) {
     mbe_t *tmpcr;
     mbe_surface_t *tmpsuf;
+    mbe_pattern_t *tmpptn;
     redraw_man_t rdman;
     shape_t *path1, *path2, *rect;
     coord_t *coord1, *coord2, *coord3;
@@ -141,9 +142,10 @@
     PangoAttrList *attrs = pango_attr_list_new();
 
     tmpsuf = mbe_image_surface_create(MB_IFMT_ARGB32, w, h);
+    tmpptn = mbe_pattern_create_for_surface(tmpsuf);
     tmpcr = mbe_create(tmpsuf);
 
-    mbe_set_source_surface(cr, tmpsuf, 0, 0);
+    mbe_set_source(cr, tmpptn);
     redraw_man_init(&rdman, tmpcr, cr);
     coord1 = rdman_coord_new(&rdman, rdman.root_coord);
     coord2 = rdman_coord_new(&rdman, rdman.root_coord);
--- a/src/X_supp.c	Thu Nov 12 21:31:10 2009 +0800
+++ b/src/X_supp.c	Thu Nov 12 21:31:14 2009 +0800
@@ -37,6 +37,7 @@
     Window win;
     Visual *visual;
     mbe_surface_t *surface, *backend_surface;
+    mbe_pattern_t *surface_ptn;
     mbe_t *cr, *backend_cr;
     redraw_man_t *rdman;
     mb_tman_t *tman;
@@ -466,6 +467,9 @@
 
     xmb_rt->surface =
 	mbe_image_surface_create(MB_IFMT_ARGB32, w, h);
+
+    xmb_rt->surface_ptn =
+	mbe_pattern_create_for_surface(xmb_rt->surface);
     
     xmb_rt->backend_surface =
 	mbe_xlib_surface_create(xmb_rt->display,
@@ -476,7 +480,7 @@
     xmb_rt->cr = mbe_create(xmb_rt->surface);
     xmb_rt->backend_cr = mbe_create(xmb_rt->backend_surface);
 
-    mbe_set_source_surface(xmb_rt->backend_cr, xmb_rt->surface, 0, 0);
+    mbe_set_source(xmb_rt->backend_cr, xmb_rt->surface_ptn);
 
     xmb_rt->rdman = (redraw_man_t *)malloc(sizeof(redraw_man_t));
     redraw_man_init(xmb_rt->rdman, xmb_rt->cr, xmb_rt->backend_cr);
@@ -522,6 +526,8 @@
 
     if(xmb_rt->surface)
 	mbe_surface_destroy(xmb_rt->surface);
+    if(xmb_rt->surface_ptn)
+	mbe_pattern_destroy(xmb_rt->surface_ptn);
     if(xmb_rt->backend_surface)
 	mbe_surface_destroy(xmb_rt->backend_surface);