Mercurial > MadButterfly
comparison src/graph_engine_openvg.c @ 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 |
comparison
equal
deleted
inserted
replaced
1081:14c2bdcbbcca | 1082:af74a96e6624 |
---|---|
35 (mtx)[7] = 0; \ | 35 (mtx)[7] = 0; \ |
36 (mtx)[8] = 1; \ | 36 (mtx)[8] = 1; \ |
37 } while(0) | 37 } while(0) |
38 | 38 |
39 #define VG_MBE_SURFACE(mbe) ((mbe)->tgt->surface) | 39 #define VG_MBE_SURFACE(mbe) ((mbe)->tgt->surface) |
40 | |
41 /*! \brief Information associated with VGImage. | |
42 * | |
43 * A VGImage can associated one of pattern or surface. This type is | |
44 * used to make sure previous associated pattern or surface being | |
45 * released before new association. | |
46 * | |
47 * A _ge_openvg_img can be associated by mutltiple patterns and | |
48 * surfaces. But, at most one of associated patterns or surfaces, the | |
49 * _ge_openvg_img can be activated for at any instant. | |
50 * _ge_openvg_img::activated_for trace the object it being activated | |
51 * for. When a context will be current, the _ge_openvg_img associated | |
52 * with its surface would be activated for the surface. When a paint | |
53 * wil be used, the _ge_openvg_img associated must be activated for | |
54 * the paint. Before activated, the old activation must be | |
55 * deactivated. _ge_openvg_img::deactivate_func is a pointer to | |
56 * deactivation function of activated pattern or surface. | |
57 * | |
58 * \sa _ge_openvg_img_t | |
59 * \note This is type is for internal using of OpenVG graphic engine. | |
60 */ | |
61 struct _ge_openvg_img { | |
62 int ref; | |
63 VGImage img; | |
64 void *activated_for; | |
65 void (*deactivate_func)(void *obj); | |
66 }; | |
67 | |
68 #define SURFACE_VG_IMG(surface) ((surface)->tgt->asso_img->img) | |
40 | 69 |
41 static EGLContext init_ctx; | 70 static EGLContext init_ctx; |
42 | 71 |
43 /*! \brief Convert mb_img_fmt_t to VGImageFormat */ | 72 /*! \brief Convert mb_img_fmt_t to VGImageFormat */ |
44 static VGImageFormat | 73 static VGImageFormat |
678 _MK_CURRENT_CTX(dst_canvas); | 707 _MK_CURRENT_CTX(dst_canvas); |
679 | 708 |
680 vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); | 709 vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); |
681 vgLoadIdentity(); | 710 vgLoadIdentity(); |
682 | 711 |
683 vg_img = src_canvas->tgt->asso_img; | 712 vg_img = SURFACE_VG_IMG(src_canvas); |
684 vgDrawImage(vg_img); | 713 vgDrawImage(vg_img); |
685 | 714 |
686 display = _VG_DISPLAY(); | 715 display = _VG_DISPLAY(); |
687 eglSwapBuffers(display, VG_MBE_SURFACE(dst_canvas)); | 716 eglSwapBuffers(display, VG_MBE_SURFACE(dst_canvas)); |
688 } | 717 } |