Mercurial > MadButterfly
comparison src/graph_engine_openvg.c @ 590:b714f0c9992e openvg
include a VGPath in VG canvas
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 30 Jun 2010 19:30:32 +0800 |
parents | d733e198bb25 |
children | 71df2896877c |
comparison
equal
deleted
inserted
replaced
589:d733e198bb25 | 590:b714f0c9992e |
---|---|
218 surface = eglCreatePbufferSurface(display, config, attrib_list); | 218 surface = eglCreatePbufferSurface(display, config, attrib_list); |
219 if(surface == EGL_NO_SURFACE) | 219 if(surface == EGL_NO_SURFACE) |
220 return NULL; | 220 return NULL; |
221 | 221 |
222 mbe_surface = (mbe_surface_t *)malloc(sizeof(mbe_surface_t)); | 222 mbe_surface = (mbe_surface_t *)malloc(sizeof(mbe_surface_t)); |
223 if(mbe_surface == NULL) | 223 if(mbe_surface == NULL) { |
224 return NULL; | 224 eglDestroySurface(surface); |
225 return NULL; | |
226 } | |
225 mbe_surface->surface = surface; | 227 mbe_surface->surface = surface; |
226 mbe_surface->asso_mbe = NULL; | 228 mbe_surface->asso_mbe = NULL; |
227 | 229 |
228 return mbe_surface; | 230 return mbe_surface; |
229 } | 231 } |
231 mbe_t * | 233 mbe_t * |
232 mbe_create(mbe_surface_t *surface) { | 234 mbe_create(mbe_surface_t *surface) { |
233 EGLDisplay display; | 235 EGLDisplay display; |
234 EGLConfig config; | 236 EGLConfig config; |
235 EGLContext ctx, shared; | 237 EGLContext ctx, shared; |
238 VGPath path; | |
236 EGLint attrib_list[2] = {EGL_NONE}; | 239 EGLint attrib_list[2] = {EGL_NONE}; |
237 mbe_t *canvas; | 240 mbe_t *canvas; |
238 | 241 |
239 display = _VG_DISPLAY(); | 242 display = _VG_DISPLAY(); |
240 ctx = eglCreateContext(display, config, shared, attrib_list); | 243 ctx = eglCreateContext(display, config, shared, attrib_list); |
241 if(ctx == EGL_NO_CONTEXT) | 244 if(ctx == EGL_NO_CONTEXT) |
242 return NULL; | 245 return NULL; |
243 | 246 |
247 path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, | |
248 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL); | |
249 if(path == VG_INVALID_HANDLE) { | |
250 eglDestroyContext(display, ctx); | |
251 return NULL; | |
252 } | |
253 | |
244 canvas = (mbe_t *)malloc(sizeof(mbe_t)); | 254 canvas = (mbe_t *)malloc(sizeof(mbe_t)); |
245 if(canvas == NULL) | 255 if(canvas == NULL) { |
246 return NULL; | 256 eglDestroyContext(display, ctx); |
257 vgDestroyPath(path); | |
258 return NULL; | |
259 } | |
247 | 260 |
248 canvas->src = NULL; | 261 canvas->src = NULL; |
249 canvas->tgt = surface; | 262 canvas->tgt = surface; |
250 canvas->ctx = ctx; | 263 canvas->ctx = ctx; |
264 canvas->path = path; | |
251 | 265 |
252 return canvas; | 266 return canvas; |
253 } | 267 } |
268 | |
269 void | |
270 mbe_destroy(mbe_t *canvas) { | |
271 EGLDisplay display; | |
272 | |
273 display = _VG_DISPLAY(); | |
274 | |
275 vgDestroyPath(canvas->path); | |
276 eglDestroyContext(display, canvas->ctx); | |
277 canvas->tgt->asso_mbe = NULL; | |
278 free(ctx); | |
279 } |