Mercurial > MadButterfly
changeset 1082:af74a96e6624 openvg
Fix bug of access VGImage of a surface
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 03 Dec 2010 01:27:24 +0800 |
parents | 14c2bdcbbcca |
children | 555d89e704c0 |
files | include/mb_graph_engine_openvg.h src/graph_engine_openvg.c |
diffstat | 2 files changed, 30 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/include/mb_graph_engine_openvg.h Fri Dec 03 01:11:14 2010 +0800 +++ b/include/mb_graph_engine_openvg.h Fri Dec 03 01:27:24 2010 +0800 @@ -121,33 +121,6 @@ VGPaint paint; }; -/*! \brief Information associated with VGImage. - * - * A VGImage can associated one of pattern or surface. This type is - * used to make sure previous associated pattern or surface being - * released before new association. - * - * A _ge_openvg_img can be associated by mutltiple patterns and - * surfaces. But, at most one of associated patterns or surfaces, the - * _ge_openvg_img can be activated for at any instant. - * _ge_openvg_img::activated_for trace the object it being activated - * for. When a context will be current, the _ge_openvg_img associated - * with its surface would be activated for the surface. When a paint - * wil be used, the _ge_openvg_img associated must be activated for - * the paint. Before activated, the old activation must be - * deactivated. _ge_openvg_img::deactivate_func is a pointer to - * deactivation function of activated pattern or surface. - * - * \sa _ge_openvg_img_t - * \note This is type is for internal using of OpenVG graphic engine. - */ -struct _ge_openvg_img { - int ref; - VGImage img; - void *activated_for; - void (*deactivate_func)(void *obj); -}; - #define MB_MATRIX_2_OPENVG(vgmtx, mtx) do { \ (vgmtx)[0] = (mtx)[0]; \ (vgmtx)[1] = (mtx)[1]; \
--- a/src/graph_engine_openvg.c Fri Dec 03 01:11:14 2010 +0800 +++ b/src/graph_engine_openvg.c Fri Dec 03 01:27:24 2010 +0800 @@ -38,6 +38,35 @@ #define VG_MBE_SURFACE(mbe) ((mbe)->tgt->surface) +/*! \brief Information associated with VGImage. + * + * A VGImage can associated one of pattern or surface. This type is + * used to make sure previous associated pattern or surface being + * released before new association. + * + * A _ge_openvg_img can be associated by mutltiple patterns and + * surfaces. But, at most one of associated patterns or surfaces, the + * _ge_openvg_img can be activated for at any instant. + * _ge_openvg_img::activated_for trace the object it being activated + * for. When a context will be current, the _ge_openvg_img associated + * with its surface would be activated for the surface. When a paint + * wil be used, the _ge_openvg_img associated must be activated for + * the paint. Before activated, the old activation must be + * deactivated. _ge_openvg_img::deactivate_func is a pointer to + * deactivation function of activated pattern or surface. + * + * \sa _ge_openvg_img_t + * \note This is type is for internal using of OpenVG graphic engine. + */ +struct _ge_openvg_img { + int ref; + VGImage img; + void *activated_for; + void (*deactivate_func)(void *obj); +}; + +#define SURFACE_VG_IMG(surface) ((surface)->tgt->asso_img->img) + static EGLContext init_ctx; /*! \brief Convert mb_img_fmt_t to VGImageFormat */ @@ -680,7 +709,7 @@ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); vgLoadIdentity(); - vg_img = src_canvas->tgt->asso_img; + vg_img = SURFACE_VG_IMG(src_canvas); vgDrawImage(vg_img); display = _VG_DISPLAY();