changeset 1081:14c2bdcbbcca openvg

Make an association between mbe and surface for OpenVG
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 03 Dec 2010 01:11:14 +0800
parents 394d7d4c0673
children af74a96e6624
files src/graph_engine_openvg.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/graph_engine_openvg.c	Thu Dec 02 12:22:55 2010 +0800
+++ b/src/graph_engine_openvg.c	Fri Dec 03 01:11:14 2010 +0800
@@ -38,6 +38,8 @@
 
 #define VG_MBE_SURFACE(mbe) ((mbe)->tgt->surface)
 
+static EGLContext init_ctx;
+
 /*! \brief Convert mb_img_fmt_t to VGImageFormat */
 static VGImageFormat
 _mb_ifmt_2_vgifmt(mb_img_fmt_t fmt) {
@@ -583,6 +585,7 @@
     }
 
     surface->surface = egl_surface;
+    surface->asso_mbe = NULL;
     surface->asso_img = NULL;
     surface->fmt = fmt;
 
@@ -701,7 +704,8 @@
     if(r != 0)
 	return NULL;
     
-    shared = EGL_NO_CONTEXT;
+    /* shared = EGL_NO_CONTEXT; */
+    shared = init_ctx;
     ctx = eglCreateContext(display, config, shared, attrib_list);
     if(ctx == EGL_NO_CONTEXT)
 	return NULL;
@@ -726,6 +730,8 @@
     canvas->tgt = surface;
     canvas->ctx = ctx;
     canvas->path = path;
+
+    surface->asso_mbe = canvas;
     
     /* Set clear color for the context */
     _MK_CURRENT_CTX(canvas);
@@ -837,7 +843,6 @@
 }
 
 void mbe_init() {
-    static EGLContext init_ctx;
     static EGLSurface init_surf;
     EGLDisplay display;
     EGLConfig config;