# HG changeset patch # User Thinker K.F. Li # Date 1277862257 -28800 # Node ID 543a2a8523fb6f8b5be2984fc9dd83aaece407c1 # Parent ca57132020e48f58d47f5f648c1bcce69b33ae39 Make surce current VG context diff -r ca57132020e4 -r 543a2a8523fb include/mb_graph_engine_openvg.h --- a/include/mb_graph_engine_openvg.h Wed Jun 30 09:29:28 2010 +0800 +++ b/include/mb_graph_engine_openvg.h Wed Jun 30 09:44:17 2010 +0800 @@ -116,9 +116,19 @@ } while(0) extern EGLNativeDisplayType _ge_openvg_disp_id; +extern mbe_t *_ge_openvg_current_canvas; -#define _MK_CURRENT_CTX(canvas) /* TODO: Make the context of a canvas - * as current context */ +#define _VG_DISPLAY() eglGetDisplay(_ge_openvg_disp_id) + +/* \brief Make the context of a canvas to be current context. + */ +#define _MK_CURRENT_CTX(canvas) do { \ + if(_ge_openvg_current_canvas != (canvas)) { \ + _ge_openvg_current_canvas = canvas; \ + eglMakeCurrent(_VG_DISPLAY(), (canvas)->tgt, \ + (canvas)->tgt, (canvas)->ctx); \ + } \ + } while(0) static void mbe_transform(mbe_t *canvas, co_aix *mtx) { @@ -129,8 +139,6 @@ vgLoadMatrix(vg_mtx); } -#define _VG_DISPLAY() eglGetDisplay(_ge_openvg_disp_id) - static int _openvg_find_confg(mb_img_fmt_t fmt, int w, int h, EGLConfig *config) { diff -r ca57132020e4 -r 543a2a8523fb src/graph_engine_openvg.c --- a/src/graph_engine_openvg.c Wed Jun 30 09:29:28 2010 +0800 +++ b/src/graph_engine_openvg.c Wed Jun 30 09:44:17 2010 +0800 @@ -1,4 +1,4 @@ #include "mb_graph_engine_openvg.h" EGLNativeDisplayType _ge_openvg_disp_id = EGL_DEFAULT_DISPLAY; - +mbe_t *_ge_openvg_current_canvas = NULL;