comparison include/mb_graph_engine_openvg.h @ 618:35a67a837a53 openvg

Use reference count to trace life of _ge_openvg_img_t objects
author Thinker K.F. Li <thinker@branda.to>
date Thu, 08 Jul 2010 13:51:47 +0800
parents 89fee368e367
children 7020ed3c3e37
comparison
equal deleted inserted replaced
617:89fee368e367 618:35a67a837a53
21 #define mbe_scaled_font_destroy(scaled) 21 #define mbe_scaled_font_destroy(scaled)
22 #define mbe_font_face_reference(face) ((mbe_font_face_t *)NULL) 22 #define mbe_font_face_reference(face) ((mbe_font_face_t *)NULL)
23 #define mbe_scaled_font_create(face, fnt_mtx, ctm) ((mbe_scaled_font_t *)NULL) 23 #define mbe_scaled_font_create(face, fnt_mtx, ctm) ((mbe_scaled_font_t *)NULL)
24 #define mbe_font_face_destroy(face) 24 #define mbe_font_face_destroy(face)
25 #define mbe_set_scaled_font(canvas, scaled) 25 #define mbe_set_scaled_font(canvas, scaled)
26 #define mbe_pattern_destroy(pattern)
27 #define mbe_get_scaled_font(canvas) ((mbe_scaled_font_t *)NULL) 26 #define mbe_get_scaled_font(canvas) ((mbe_scaled_font_t *)NULL)
28 #define mbe_query_font_face(family, slant, weight) ((mbe_font_face_t *)NULL) 27 #define mbe_query_font_face(family, slant, weight) ((mbe_font_face_t *)NULL)
29 #define mbe_free_font_face(face) 28 #define mbe_free_font_face(face)
30 #define mbe_set_line_width(canvas, w) \ 29 #define mbe_set_line_width(canvas, w) \
31 do { \ 30 do { \
118 * 117 *
119 * \sa _ge_openvg_img_t 118 * \sa _ge_openvg_img_t
120 * \note This is type is for internal using of OpenVG graphic engine. 119 * \note This is type is for internal using of OpenVG graphic engine.
121 */ 120 */
122 struct _ge_openvg_img { 121 struct _ge_openvg_img {
122 int ref;
123 VGImage img; 123 VGImage img;
124 mbe_pattern_t *asso_pattern; 124 mbe_pattern_t *asso_pattern;
125 mbe_surface_t *asso_surface; 125 mbe_surface_t *asso_surface;
126 }; 126 };
127 127
151 extern mbe_pattern_t *mbe_pattern_create_linear(co_aix x0, co_aix y0, 151 extern mbe_pattern_t *mbe_pattern_create_linear(co_aix x0, co_aix y0,
152 co_aix x1, co_aix y1, 152 co_aix x1, co_aix y1,
153 grad_stop_t *stops, 153 grad_stop_t *stops,
154 int stop_cnt); 154 int stop_cnt);
155 extern mbe_pattern_t *mbe_pattern_create_image(mb_img_data_t *img); 155 extern mbe_pattern_t *mbe_pattern_create_image(mb_img_data_t *img);
156 extern void mbe_pattern_destroy(mbe_pattern_t *ptn);
156 extern void mbe_pattern_set_matrix(mbe_pattern_t *ptn, co_aix *mtx); 157 extern void mbe_pattern_set_matrix(mbe_pattern_t *ptn, co_aix *mtx);
157 extern void mbe_set_source_rgba(mbe_t *canvas, co_comp_t r, co_comp_t g, 158 extern void mbe_set_source_rgba(mbe_t *canvas, co_comp_t r, co_comp_t g,
158 co_comp_t b, co_comp_t a); 159 co_comp_t b, co_comp_t a);
159 /* TODO: rename n_areas to areas_cnt and make it after areas */ 160 /* TODO: rename n_areas to areas_cnt and make it after areas */
160 extern void mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas); 161 extern void mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas);
201 int width, int height); 202 int width, int height);
202 #endif 203 #endif
203 204
204 extern mbe_surface_t *mbe_image_surface_create(mb_img_fmt_t fmt, 205 extern mbe_surface_t *mbe_image_surface_create(mb_img_fmt_t fmt,
205 int w, int h); 206 int w, int h);
206 207 extern void mbe_surface_destroy(mbe_surface_t *surface);
207 static void
208 mbe_surface_destroy(mbe_surface_t *surface) {
209 EGLDisplay display;
210
211 display = _VG_DISPLAY();
212 eglDestroySurface(display, surface->surface);
213
214 if(surface->asso_mbe)
215 surface->asso_mbe->tgt = NULL;
216
217 if(surface->asso_img)
218 surface->asso_img->asso_surface = NULL;
219
220 free(surface);
221 }
222 208
223 extern mbe_t *mbe_create(mbe_surface_t *surface); 209 extern mbe_t *mbe_create(mbe_surface_t *surface);
224 extern void mbe_destroy(mbe_t *canvas); 210 extern void mbe_destroy(mbe_t *canvas);
225 extern void mbe_paint_with_alpha(mbe_t *canvas, co_comp_t alpha); 211 extern void mbe_paint_with_alpha(mbe_t *canvas, co_comp_t alpha);
226 extern void mbe_paint(mbe_t *canvas); 212 extern void mbe_paint(mbe_t *canvas);