Mercurial > MadButterfly
comparison src/graph_engine_openvg.c @ 595:aaaaa03af04d openvg
Set VGPaint for canvas
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Thu, 01 Jul 2010 14:24:02 +0800 |
parents | ac942664fe86 |
children | aaab76730beb |
comparison
equal
deleted
inserted
replaced
594:d416e1fff71a | 595:aaaaa03af04d |
---|---|
7 #define ASSERT(x) | 7 #define ASSERT(x) |
8 #endif | 8 #endif |
9 | 9 |
10 void | 10 void |
11 mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) { | 11 mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) { |
12 static VGint *coords = NULL; | 12 static VGint *scissors = NULL; |
13 static int coords_sz = 0; | 13 static int n_scissors = 0; |
14 VGint *coord; | 14 VGint *coord; |
15 area_t *area; | 15 area_t *area; |
16 int i; | 16 int i; |
17 | 17 |
18 _MK_CURRENT_CTX(canvas); | 18 _MK_CURRENT_CTX(canvas); |
19 | 19 |
20 if(n_areas > coords_sz) { | 20 if(n_areas > n_scissors) { |
21 if(coords) free(coords); | 21 if(scissors) free(scissors); |
22 coords_sz = (n_areas + 0xf) & 0xf; | 22 n_scissors = (n_areas + 0xf) & 0xf; |
23 coords = (VGint *)malloc(sizeof(VGint) * coords_sz * 4); | 23 scissors = (VGint *)malloc(sizeof(VGint) * n_scissors * 4); |
24 ASSERT(coords != NULL); | 24 ASSERT(scissors != NULL); |
25 } | 25 } |
26 | 26 |
27 coord = coords; | 27 coord = scissors; |
28 for(i = 0; i < n_areas; i++) { | 28 for(i = 0; i < n_areas; i++) { |
29 area = areas[i]; | 29 area = areas[i]; |
30 *coord++ = area->x; | 30 *coord++ = area->x; |
31 *coord++ = area->y; | 31 *coord++ = area->y; |
32 *coord++ = area->w; | 32 *coord++ = area->w; |
33 *coord++ = area->h; | 33 *coord++ = area->h; |
34 } | 34 } |
35 | 35 |
36 vgSetiv(VG_SCISSOR_RECTS, n_areas * 4, coords); | 36 vgSetiv(VG_SCISSOR_RECTS, n_areas * 4, scissors); |
37 } | 37 } |
38 | 38 |
39 static int | 39 static int |
40 _openvg_find_config(mb_img_fmt_t fmt, int w, int h, | 40 _openvg_find_config(mb_img_fmt_t fmt, int w, int h, |
41 EGLConfig *config) { | 41 EGLConfig *config) { |
264 vgDestroyPath(path); | 264 vgDestroyPath(path); |
265 return NULL; | 265 return NULL; |
266 } | 266 } |
267 | 267 |
268 canvas->src = NULL; | 268 canvas->src = NULL; |
269 canvas->paint = VG_INVALID_HANDLE; | |
269 canvas->tgt = surface; | 270 canvas->tgt = surface; |
270 canvas->ctx = ctx; | 271 canvas->ctx = ctx; |
271 canvas->path = path; | 272 canvas->path = path; |
272 | 273 |
273 return canvas; | 274 return canvas; |
283 eglDestroyContext(display, canvas->ctx); | 284 eglDestroyContext(display, canvas->ctx); |
284 canvas->tgt->asso_mbe = NULL; /* remove association */ | 285 canvas->tgt->asso_mbe = NULL; /* remove association */ |
285 free(canvas); | 286 free(canvas); |
286 } | 287 } |
287 | 288 |
289 void | |
290 mbe_paint(mbe_t *canvas) { | |
291 | |
292 } | |
293 |