annotate src/graph_engine_openvg.c @ 605:a8fa4c550fe5 openvg

use O_ALLOC() to make code clear
author Thinker K.F. Li <thinker@branda.to>
date Sun, 04 Jul 2010 15:39:12 +0800
parents 38514a7c6b26
children e21eb54c7d9c
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"
604
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
2 #include "mb_tools.h"
582
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
dd546c4da180 deal with EGL surface, context for OpenVG GE
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 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
5 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
6
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
7 #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
8 #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
9 #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
10
598
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
11 #define MB_2_VG_COLOR(r, g, b, a) ((((int)(0xf * r) & 0xf) << 24) | \
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
12 (((int)(0xf * g) & 0xf) << 16) | \
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
13 (((int)(0xf * b) & 0xf) << 16) | \
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
14 ((int)(0xf * a) & 0xf))
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
15
604
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
16 mbe_pattern_t *
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
17 mbe_pattern_create_linear(co_aix x0, co_aix y0,
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
18 co_aix x1, co_aix y1,
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
19 grad_stop_t *stops, int stop_cnt) {
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
20 VGPaint paint;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
21 mbe_pattern_t *pattern;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
22 VGfloat gradient[] = {x0, y0, x1, y1};
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
23 static VGfloat *ov_stops = 0;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
24 static int max_stop_cnt = 0;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
25 VGfloat *cur_ov_stop;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
26 grad_stop_t *cur_stop;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
27 int i;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
28
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
29 /* Make sure there is enough space */
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
30 if(max_stop_cnt < stop_cnt) {
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
31 max_stop_cnt = (stop_cnt + 0xf) & ~0xf;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
32 cur_ov_stop = (VGfloat *)realloc(stops,
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
33 max_stop_cnt * sizeof(VGfloat) * 5);
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
34 if(cur_ov_stop == NULL) {
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
35 max_stop_cnt = 0;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
36 return NULL;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
37 }
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
38 ov_stops = cur_ov_stop;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
39 }
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
40 cur_ov_stop = ov_stops;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
41
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
42 cur_stop = stops;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
43 for(i = 0; i < stop_cnt; i++) {
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
44 *cur_ov_stop++ = cur_stop->offset;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
45 *cur_ov_stop++ = cur_stop->r;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
46 *cur_ov_stop++ = cur_stop->g;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
47 *cur_ov_stop++ = cur_stop->b;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
48 *cur_ov_stop++ = cur_stop->a;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
49 }
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
50
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
51 paint = vgCreatePaint();
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
52 if(paint == VG_INVALID_HANDLE)
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
53 return NULL;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
54 vgSetParameteri(paint, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT);
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
55 vgSetParameterfv(paint, VG_PAINT_LINEAR_GRADIENT, 4, gradient);
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
56 vgSetParameterfv(paint, VG_PAINT_COLOR_RAMP_STOPS, 5 * stop_cnt, ov_stops);
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
57
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
58 pattern = O_ALLOC(mbe_pattern_t);
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
59 if(pattern == NULL) {
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
60 vgPaintDestroy(paint);
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
61 return NULL;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
62 }
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
63
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
64 pattern->paint = paint;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
65 pattern->asso_img = NULL;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
66
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
67 return pattern;
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
68 }
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
69
600
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 598
diff changeset
70 void
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 598
diff changeset
71 mbe_set_source_rgba(mbe_t *canvas, co_comp_t r, co_comp_t g,
20b396c09c23 Integrate pattern source with paint model of canvas
Thinker K.F. Li <thinker@branda.to>
parents: 598
diff changeset
72 co_comp_t b, co_comp_t a) {
598
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
73 VGPaint paint;
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
74 VGuint color;
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
75
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
76 if(paint != VG_INVALID_HANDLE && canvas->src == NULL)
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
77 paint = canvas->paint; /* previous one is also a color paint */
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
78 else {
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
79 paint = vgCreatePaint();
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
80 ASSERT(paint != VG_INVALID_HANDLE);
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
81 canvas->paint = paint;
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
82 canvas->src = NULL;
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
83 }
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
84
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
85 color = MB_2_VG_COLOR(r, g, b, a);
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
86 vgSetColor(paint, color);
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
87 canvas->paint_installed = 0;
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
88 }
aba62eb9362d define color source for VG
Thinker K.F. Li <thinker@branda.to>
parents: 597
diff changeset
89
588
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
90 void
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
91 mbe_scissoring(mbe_t *canvas, int n_areas, area_t **areas) {
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
92 static VGint *scissors = NULL;
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
93 static int n_scissors = 0;
588
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
94 VGint *coord;
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
95 area_t *area;
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
96 int i;
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
97
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
98 _MK_CURRENT_CTX(canvas);
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
99
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
100 if(n_areas > n_scissors) {
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
101 if(scissors) free(scissors);
604
38514a7c6b26 Linear gradient for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 600
diff changeset
102 n_scissors = (n_areas + 0xf) & ~0xf;
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
103 scissors = (VGint *)malloc(sizeof(VGint) * n_scissors * 4);
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
104 ASSERT(scissors != NULL);
588
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
105 }
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
106
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
107 coord = scissors;
588
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
108 for(i = 0; i < n_areas; i++) {
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
109 area = areas[i];
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
110 *coord++ = area->x;
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
111 *coord++ = area->y;
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
112 *coord++ = area->w;
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
113 *coord++ = area->h;
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
114 }
e9923024f65e Implement mbe_scissoring() for OpenVG
Thinker K.F. Li <thinker@branda.to>
parents: 584
diff changeset
115
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
116 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
117 }
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
118
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 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
120 _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
121 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
122 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
123 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
124 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
125 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
126 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
127 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
128
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 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
130 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
131 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
132 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
133 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
134 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
135 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
136 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
137 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
138 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
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 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149
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 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
151 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
152 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
153 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
154
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 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
156 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
157 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
158 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
159
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 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
161 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
162 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
163 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
164 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
165 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
166 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
167 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
168
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 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
170 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
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
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 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
174 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
175 #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
176 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
177 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
178 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
179 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
180 #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
181
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 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
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 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
185 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
186 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
187 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
188
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 *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
190
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 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
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
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 #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
195 #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
196 #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
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 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
199 _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
200 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
201 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
202 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
203 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
204 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
205
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 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
207 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
208 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
209 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
210 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
211
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 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
213 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
214 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
215 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
216
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
217 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
218 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
219 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
220
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 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
222 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
223 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
224
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 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
226 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
227 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
228
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
229 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
230 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
231 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
232 }
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
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
234 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
235 }
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 /*! \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
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 * 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
240 */
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_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
242 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
243 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
244 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
245 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
246 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
247 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
248 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
249 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
250 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
251
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 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
253 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
254 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
255
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
256 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
257 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
258 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
259
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
260 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
261 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
262 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
263
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
264 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
265 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
266
605
a8fa4c550fe5 use O_ALLOC() to make code clear
Thinker K.F. Li <thinker@branda.to>
parents: 604
diff changeset
267 surface = O_ALLOC(mbe_surface_t);
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
268 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
269 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
270 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
271 }
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
272
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 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
274
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 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
276 }
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
277
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
278 #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
279
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
280 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
281 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
282 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
283 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
284 EGLConfig config;
592
de9d210e9c38 Specify width and height while create an image surface
Thinker K.F. Li <thinker@branda.to>
parents: 591
diff changeset
285 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
286 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
287 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
288
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
289
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
290 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
291 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
292 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
293
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
294 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
295 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
296 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
297 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
298 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
299 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
300 /* 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
301 * 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
302 */
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
303 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
304 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
305 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
306
605
a8fa4c550fe5 use O_ALLOC() to make code clear
Thinker K.F. Li <thinker@branda.to>
parents: 604
diff changeset
307 mbe_surface = O_ALLOC(mbe_surface_t);
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
308 if(mbe_surface == NULL) {
591
71df2896877c build graph_engine_openvg.c in makefile
Thinker K.F. Li <thinker@branda.to>
parents: 590
diff changeset
309 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
310 return NULL;
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
311 }
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
312 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
313 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
314 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
315 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
316
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
317 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
318 }
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
319
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
320 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
321 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
322 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
323 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
324 EGLContext ctx, shared;
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
325 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
326 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
327 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
328
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
329 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
330 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
331 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
332 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
333
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
334 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
335 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
336 if(path == VG_INVALID_HANDLE) {
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
337 eglDestroyContext(display, ctx);
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
338 return NULL;
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
339 }
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
340
605
a8fa4c550fe5 use O_ALLOC() to make code clear
Thinker K.F. Li <thinker@branda.to>
parents: 604
diff changeset
341 canvas = O_ALLOC(mbe_t);
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
342 if(canvas == NULL) {
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
343 eglDestroyContext(display, ctx);
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
344 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
345 return NULL;
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
346 }
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
347
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
348 canvas->src = NULL;
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
349 canvas->paint = VG_INVALID_HANDLE;
597
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
350 canvas->paint_installed = 0;
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
351 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
352 canvas->ctx = ctx;
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
353 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
354
d733e198bb25 Move functions from mb_graph_engine_openvg.h to the C file
Thinker K.F. Li <thinker@branda.to>
parents: 588
diff changeset
355 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
356 }
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
357
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
358 void
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
359 mbe_destroy(mbe_t *canvas) {
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
360 EGLDisplay display;
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
361
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
362 display = _VG_DISPLAY();
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
363
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
364 vgDestroyPath(canvas->path);
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
365 eglDestroyContext(display, canvas->ctx);
591
71df2896877c build graph_engine_openvg.c in makefile
Thinker K.F. Li <thinker@branda.to>
parents: 590
diff changeset
366 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
367 free(canvas);
590
b714f0c9992e include a VGPath in VG canvas
Thinker K.F. Li <thinker@branda.to>
parents: 589
diff changeset
368 }
593
ac942664fe86 stroke and fill for VG
Thinker K.F. Li <thinker@branda.to>
parents: 592
diff changeset
369
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
370 void
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
371 mbe_paint(mbe_t *canvas) {
596
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
372 EGLDisplay display;
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
373 EGLint w, h;
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
374 EGLBoolean r;
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
375 VGPath path;
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
376
596
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
377 _MK_CURRENT_CTX(canvas);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
378 _MK_CURRENT_PAINT(canvas);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
379
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
380 display = _VG_DISPLAY();
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
381
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
382 r = eglQuerySurface(display, canvas->tgt, EGL_WIDTH, &w);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
383 ASSERT(r == EGL_TRUE);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
384 r = eglQuerySurface(display, canvas->tgt, EGL_HEIGHT, &h);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
385 ASSERT(r == EGL_TRUE);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
386
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
387 vgSeti(VG_SCISSORING, VG_FALSE);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
388
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
389 path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F,
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
390 1, 0, 0, 0, VG_PATH_CAPABILITY_ALL);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
391 vguRect(path, 0, 0, w, h);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
392 vgDrawPath(path, VG_FILL_PATH);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
393 vgDestroyPath(path);
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
394
aaab76730beb Define mbe_paint() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 595
diff changeset
395 vgSeti(VG_SCISSORING, VG_TRUE);
595
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
396 }
aaaaa03af04d Set VGPaint for canvas
Thinker K.F. Li <thinker@branda.to>
parents: 593
diff changeset
397
597
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
398 void
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
399 mbe_clear(mbe_t *canvas) {
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
400 VGPaint paint;
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
401
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
402 _MK_CURRENT_CTX(canvas);
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
403
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
404 paint = vgCreatePaint();
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
405 ASSERT(paint != VG_INVALID_HANDLE);
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
406 vgSetColor(paint, 0);
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
407
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
408 vgSetPaint(paint, VG_FILL_PATH);
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
409 vgSeti(VG_BLEND_MODE, VG_BLEND_SRC);
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
410 vgDrawPath(canvas->path, VG_FILL_PATH);
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
411 vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
412
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
413 vgDestroyPaint(paint);
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
414
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
415 canvas->paint_installed = 0;
3300992b29ff Define mbe_clear() for VG
Thinker K.F. Li <thinker@branda.to>
parents: 596
diff changeset
416 }