Mercurial > MadButterfly
comparison src/graph_engine_openvg.c @ 592:de9d210e9c38 openvg
Specify width and height while create an image surface
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 30 Jun 2010 19:53:10 +0800 |
parents | 71df2896877c |
children | ac942664fe86 |
comparison
equal
deleted
inserted
replaced
591:71df2896877c | 592:de9d210e9c38 |
---|---|
200 mbe_surface_t * | 200 mbe_surface_t * |
201 mbe_image_surface_create(mb_img_fmt_t fmt, int w, int h) { | 201 mbe_image_surface_create(mb_img_fmt_t fmt, int w, int h) { |
202 EGLSurface surface; | 202 EGLSurface surface; |
203 EGLDisplay display; | 203 EGLDisplay display; |
204 EGLConfig config; | 204 EGLConfig config; |
205 EGLint attrib_list[2] = {EGL_NONE}; | 205 EGLint attrib_list[5]; |
206 mbe_surface_t *mbe_surface; | 206 mbe_surface_t *mbe_surface; |
207 int r; | 207 int r; |
208 | 208 |
209 | 209 |
210 r = _openvg_find_config(fmt, w, h, &config); | 210 r = _openvg_find_config(fmt, w, h, &config); |
211 if(r != 0) | 211 if(r != 0) |
212 return NULL; | 212 return NULL; |
213 | 213 |
214 display = _VG_DISPLAY(); | 214 display = _VG_DISPLAY(); |
215 attrib_list[0] = EGL_WIDTH; | |
216 attrib_list[1] = w; | |
217 attrib_list[2] = EGL_HEIGHT; | |
218 attrib_list[3] = h; | |
219 attrib_list[4] = EGL_NONE; | |
215 /* Some implementation does not support pbuffer. | 220 /* Some implementation does not support pbuffer. |
216 * We need use some other surface to replace this one. | 221 * We need use some other surface to replace this one. |
217 */ | 222 */ |
218 surface = eglCreatePbufferSurface(display, config, attrib_list); | 223 surface = eglCreatePbufferSurface(display, config, attrib_list); |
219 if(surface == EGL_NO_SURFACE) | 224 if(surface == EGL_NO_SURFACE) |
224 eglDestroySurface(display, surface); | 229 eglDestroySurface(display, surface); |
225 return NULL; | 230 return NULL; |
226 } | 231 } |
227 mbe_surface->surface = surface; | 232 mbe_surface->surface = surface; |
228 mbe_surface->asso_mbe = NULL; | 233 mbe_surface->asso_mbe = NULL; |
234 mbe_surface->w = w; | |
235 mbe_surface->h = h; | |
229 | 236 |
230 return mbe_surface; | 237 return mbe_surface; |
231 } | 238 } |
232 | 239 |
233 mbe_t * | 240 mbe_t * |