changeset 622:39bd74da7f92 openvg

mbe_copy_source() for OpenVG
author Thinker K.F. Li <thinker@branda.to>
date Fri, 09 Jul 2010 11:50:48 +0800
parents d8cdd57ceff5
children e4138c12fa8c
files include/mb_graph_engine_openvg.h src/graph_engine_openvg.c
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/include/mb_graph_engine_openvg.h	Fri Jul 09 10:45:23 2010 +0800
+++ b/include/mb_graph_engine_openvg.h	Fri Jul 09 11:50:48 2010 +0800
@@ -34,7 +34,6 @@
 #define mbe_set_source_rgb(canvas, r, g, b)	\
     mbe_set_source_rgba(canvas, r, g, b, 1)
 #define mbe_get_font_face(canvas) ((mbe_font_face_t *)NULL)
-#define mbe_copy_source(src_canvas, dst_canvas)
 #define mbe_set_source(canvas, pattern)		\
     do {					\
 	(canvas)->src = (pattern);		\
@@ -239,6 +238,7 @@
 					       int w, int h);
 extern void mbe_surface_destroy(mbe_surface_t *surface);
 
+extern void mbe_copy_source(mbe_t *src_canvas, mbe_t *dst_canvas);
 extern mbe_t *mbe_create(mbe_surface_t *surface);
 extern void mbe_destroy(mbe_t *canvas);
 extern void mbe_paint_with_alpha(mbe_t *canvas, co_comp_t alpha);
--- a/src/graph_engine_openvg.c	Fri Jul 09 10:45:23 2010 +0800
+++ b/src/graph_engine_openvg.c	Fri Jul 09 11:50:48 2010 +0800
@@ -651,6 +651,21 @@
     free(surface);
 }
 
+void
+mbe_copy_source(mbe_t *src_canvas, mbe_t *dst_canvas) {
+    VGImage vg_img;
+    
+    ASSERT(src_canvas->tgt->asso_img != NULL);
+    
+    _MK_CURRENT_CTX(dst_canvas);
+    
+    vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+    vgLoadIdentity();
+    
+    vg_img = src_canvas->tgt->asso_img;
+    vgDrawImage(vg_img);
+}
+
 mbe_t *
 mbe_create(mbe_surface_t *surface) {
     EGLDisplay display;