Mercurial > MadButterfly
annotate 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 |
rev | line source |
---|---|
582
dd546c4da180
deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 #include "mb_graph_engine_openvg.h" |
dd546c4da180
deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 |
dd546c4da180
deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 EGLNativeDisplayType _ge_openvg_disp_id = EGL_DEFAULT_DISPLAY; |
584
543a2a8523fb
Make surce current VG context
Thinker K.F. Li <thinker@branda.to>
parents:
582
diff
changeset
|
4 mbe_t *_ge_openvg_current_canvas = NULL; |
588
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
5 |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
6 #ifndef ASSERT |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
7 #define ASSERT(x) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
8 #endif |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
9 |
588
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
10 void |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
11 mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) { |
595 | 12 static VGint *scissors = NULL; |
13 static int n_scissors = 0; | |
588
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
14 VGint *coord; |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
15 area_t *area; |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
16 int i; |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
17 |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
18 _MK_CURRENT_CTX(canvas); |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
19 |
595 | 20 if(n_areas > n_scissors) { |
21 if(scissors) free(scissors); | |
22 n_scissors = (n_areas + 0xf) & 0xf; | |
23 scissors = (VGint *)malloc(sizeof(VGint) * n_scissors * 4); | |
24 ASSERT(scissors != NULL); | |
588
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
25 } |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
26 |
595 | 27 coord = scissors; |
588
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
28 for(i = 0; i < n_areas; i++) { |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
29 area = areas[i]; |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
30 *coord++ = area->x; |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
31 *coord++ = area->y; |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
32 *coord++ = area->w; |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
33 *coord++ = area->h; |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
34 } |
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
35 |
595 | 36 vgSetiv(VG_SCISSOR_RECTS, n_areas * 4, scissors); |
588
e9923024f65e
Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents:
584
diff
changeset
|
37 } |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
38 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
39 static int |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
40 _openvg_find_config(mb_img_fmt_t fmt, int w, int h, |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
41 EGLConfig *config) { |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
42 EGLDisplay display; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
43 EGLint attrib_list[16]; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
44 EGLConfig configs[1]; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
45 EGLint nconfigs; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
46 int i = 0; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
47 EGLBoolean r; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
48 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
49 switch(fmt) { |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
50 case MB_IFMT_ARGB32: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
51 attrib_list[i++] = EGL_RED_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
52 attrib_list[i++] = 8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
53 attrib_list[i++] = EGL_GREEN_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
54 attrib_list[i++] = 8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
55 attrib_list[i++] = EGL_BLUE_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
56 attrib_list[i++] = 8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
57 attrib_list[i++] = EGL_ALPHA_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
58 attrib_list[i++] = 8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
59 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
60 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
61 case MB_IFMT_RGB24: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
62 attrib_list[i++] = EGL_RED_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
63 attrib_list[i++] = 8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
64 attrib_list[i++] = EGL_GREEN_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
65 attrib_list[i++] = 8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
66 attrib_list[i++] = EGL_BLUE_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
67 attrib_list[i++] = 8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
68 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
69 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
70 case MB_IFMT_A8: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
71 attrib_list[i++] = EGL_ALPHA_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
72 attrib_list[i++] = 8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
73 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
74 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
75 case MB_IFMT_A1: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
76 attrib_list[i++] = EGL_ALPHA_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
77 attrib_list[i++] = 1; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
78 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
79 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
80 case MB_IFMT_RGB16_565: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
81 attrib_list[i++] = EGL_RED_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
82 attrib_list[i++] = 5; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
83 attrib_list[i++] = EGL_GREEN_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
84 attrib_list[i++] = 6; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
85 attrib_list[i++] = EGL_BLUE_SIZE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
86 attrib_list[i++] = 5; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
87 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
88 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
89 default: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
90 return -1; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
91 } |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
92 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
93 attrib_list[i++] = EGL_SURFACE_TYPE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
94 attrib_list[i++] = EGL_PBUFFER_BIT; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
95 #if 0 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
96 attrib_list[i++] = EGL_MAX_PBUFFER_WIDTH; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
97 attrib_list[i++] = w; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
98 attrib_list[i++] = EGL_MAX_PBUFFER_HEIGHT; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
99 attrib_list[i++] = h; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
100 #endif |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
101 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
102 attrib_list[i++] = EGL_NONE; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
103 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
104 display = _VG_DISPLAY(); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
105 r = eglChooseConfig(display, attrib_list, configs, 1, &nconfigs); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
106 if(!r) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
107 return -1; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
108 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
109 *config = configs[0]; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
110 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
111 return 0; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
112 } |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
113 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
114 #ifdef EGL_GLX |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
115 #include <X11/Xlib.h> |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
116 #include <X11/Xutil.h> |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
117 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
118 static int |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
119 _get_img_fmt_from_xvisual(Display *display, Visual *visual) { |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
120 VisualID visual_id; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
121 XVisualInfo temp; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
122 XVisualInfo *infos; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
123 int n; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
124 int fmt = -1; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
125 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
126 visual_id = XVisualIDFromVisual(visual); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
127 temp.visualid = visual_id; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
128 infos = XGetVisualInfo(display, VisualIDMask, &temp, &n); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
129 if(n != 1) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
130 return -1; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
131 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
132 switch(infos->depth) { |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
133 case 32: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
134 fmt = MB_IFMT_ARGB32; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
135 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
136 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
137 case 24: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
138 fmt = MB_IFMT_RGB24; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
139 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
140 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
141 case 16: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
142 fmt = MB_IFMT_RGB16_565; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
143 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
144 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
145 case 8: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
146 fmt = MB_IFMT_A8; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
147 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
148 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
149 case 1: |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
150 fmt = MB_IFMT_A1; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
151 break; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
152 } |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
153 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
154 return fmt; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
155 } |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
156 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
157 /*! \brief Create an EGL window surface for X11. |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
158 * |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
159 * This function is compiled only for GLX enabled. |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
160 */ |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
161 mbe_surface_t * |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
162 mbe_vg_win_surface_create(Display *display, Drawable drawable, |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
163 Visual *visual, int width, int height) { |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
164 EGLDisplay egl_disp; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
165 EGLSurface egl_surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
166 mbe_surface_t *surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
167 EGLConfig config; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
168 EGLint attrib_list[2] = {EGL_NONE}; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
169 int fmt; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
170 int r; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
171 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
172 fmt = _get_img_fmt_from_xvisual(display, visual); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
173 if(fmt == -1) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
174 return NULL; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
175 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
176 r = _openvg_find_config(fmt, width, height, &config); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
177 if(r != 0) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
178 return NULL; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
179 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
180 egl_disp = eglGetDisplay(display); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
181 if(egl_disp == EGL_NO_DISPLAY || egl_disp != _VG_DISPLAY()) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
182 return NULL; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
183 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
184 egl_surface = eglCreateWindowSurface(egl_disp, config, drawable, |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
185 attrib_list); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
186 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
187 surface = (mbe_surface_t *)malloc(sizeof(mbe_surface_t)); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
188 if(surface == NULL) { |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
189 eglDestroySurface(egl_disp, egl_surface); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
190 return NULL; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
191 } |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
192 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
193 surface->surface = egl_surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
194 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
195 return surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
196 } |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
197 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
198 #endif |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
199 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
200 mbe_surface_t * |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
201 mbe_image_surface_create(mb_img_fmt_t fmt, int w, int h) { |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
202 EGLSurface surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
203 EGLDisplay display; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
204 EGLConfig config; |
592
de9d210e9c38
Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents:
591
diff
changeset
|
205 EGLint attrib_list[5]; |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
206 mbe_surface_t *mbe_surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
207 int r; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
208 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
209 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
210 r = _openvg_find_config(fmt, w, h, &config); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
211 if(r != 0) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
212 return NULL; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
213 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
214 display = _VG_DISPLAY(); |
592
de9d210e9c38
Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents:
591
diff
changeset
|
215 attrib_list[0] = EGL_WIDTH; |
de9d210e9c38
Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents:
591
diff
changeset
|
216 attrib_list[1] = w; |
de9d210e9c38
Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents:
591
diff
changeset
|
217 attrib_list[2] = EGL_HEIGHT; |
de9d210e9c38
Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents:
591
diff
changeset
|
218 attrib_list[3] = h; |
de9d210e9c38
Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents:
591
diff
changeset
|
219 attrib_list[4] = EGL_NONE; |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
220 /* Some implementation does not support pbuffer. |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
221 * We need use some other surface to replace this one. |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
222 */ |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
223 surface = eglCreatePbufferSurface(display, config, attrib_list); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
224 if(surface == EGL_NO_SURFACE) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
225 return NULL; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
226 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
227 mbe_surface = (mbe_surface_t *)malloc(sizeof(mbe_surface_t)); |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
228 if(mbe_surface == NULL) { |
591
71df2896877c
build graph_engine_openvg.c in makefile
Thinker K.F. Li <thinker@branda.to>
parents:
590
diff
changeset
|
229 eglDestroySurface(display, surface); |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
230 return NULL; |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
231 } |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
232 mbe_surface->surface = surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
233 mbe_surface->asso_mbe = NULL; |
592
de9d210e9c38
Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents:
591
diff
changeset
|
234 mbe_surface->w = w; |
de9d210e9c38
Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents:
591
diff
changeset
|
235 mbe_surface->h = h; |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
236 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
237 return mbe_surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
238 } |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
239 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
240 mbe_t * |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
241 mbe_create(mbe_surface_t *surface) { |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
242 EGLDisplay display; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
243 EGLConfig config; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
244 EGLContext ctx, shared; |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
245 VGPath path; |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
246 EGLint attrib_list[2] = {EGL_NONE}; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
247 mbe_t *canvas; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
248 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
249 display = _VG_DISPLAY(); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
250 ctx = eglCreateContext(display, config, shared, attrib_list); |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
251 if(ctx == EGL_NO_CONTEXT) |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
252 return NULL; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
253 |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
254 path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
255 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL); |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
256 if(path == VG_INVALID_HANDLE) { |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
257 eglDestroyContext(display, ctx); |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
258 return NULL; |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
259 } |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
260 |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
261 canvas = (mbe_t *)malloc(sizeof(mbe_t)); |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
262 if(canvas == NULL) { |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
263 eglDestroyContext(display, ctx); |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
264 vgDestroyPath(path); |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
265 return NULL; |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
266 } |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
267 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
268 canvas->src = NULL; |
595 | 269 canvas->paint = VG_INVALID_HANDLE; |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
270 canvas->tgt = surface; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
271 canvas->ctx = ctx; |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
272 canvas->path = path; |
589
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
273 |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
274 return canvas; |
d733e198bb25
Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents:
588
diff
changeset
|
275 } |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
276 |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
277 void |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
278 mbe_destroy(mbe_t *canvas) { |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
279 EGLDisplay display; |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
280 |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
281 display = _VG_DISPLAY(); |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
282 |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
283 vgDestroyPath(canvas->path); |
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
284 eglDestroyContext(display, canvas->ctx); |
591
71df2896877c
build graph_engine_openvg.c in makefile
Thinker K.F. Li <thinker@branda.to>
parents:
590
diff
changeset
|
285 canvas->tgt->asso_mbe = NULL; /* remove association */ |
71df2896877c
build graph_engine_openvg.c in makefile
Thinker K.F. Li <thinker@branda.to>
parents:
590
diff
changeset
|
286 free(canvas); |
590
b714f0c9992e
include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents:
589
diff
changeset
|
287 } |
593 | 288 |
595 | 289 void |
290 mbe_paint(mbe_t *canvas) { | |
291 | |
292 } | |
293 |