Mercurial > mplayer.hg
annotate libmenu/menu.c @ 23260:427075ffb413
allow sis vidix driver to access registers and avoid segfaulting (patch by Andrew Calkin)
author | ben |
---|---|
date | Wed, 09 May 2007 17:16:59 +0000 |
parents | dc442598a7d8 |
children | 10a7279b8e56 |
rev | line source |
---|---|
8197 | 1 |
16862 | 2 #include "config.h" |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
3 #include "mp_msg.h" |
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
4 #include "help_mp.h" |
8197 | 5 |
6 #include <stdlib.h> | |
7 #include <stdio.h> | |
8 #include <string.h> | |
8604
41a1e5dbb552
This patch fixes the reading of the menu.conf, because stream_open()
arpi
parents:
8251
diff
changeset
|
9 #include <fcntl.h> |
41a1e5dbb552
This patch fixes the reading of the menu.conf, because stream_open()
arpi
parents:
8251
diff
changeset
|
10 #include <unistd.h> |
8197 | 11 |
16862 | 12 #include "libvo/osd.h" |
13 #include "libvo/font_load.h" | |
23232
c5ac43d53bb1
use already existing function to get utf8 char in libmenu (thx to reimar)
ben
parents:
23231
diff
changeset
|
14 #include "libvo/sub.h" |
16862 | 15 #include "osdep/keycodes.h" |
16 #include "asxparser.h" | |
19271
64d82a45a05d
introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
ben
parents:
18194
diff
changeset
|
17 #include "stream/stream.h" |
8197 | 18 |
19431
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19271
diff
changeset
|
19 #include "libmpcodecs/img_format.h" |
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19271
diff
changeset
|
20 #include "libmpcodecs/mp_image.h" |
16862 | 21 #include "m_option.h" |
22 #include "m_struct.h" | |
8197 | 23 #include "menu.h" |
24 | |
25 extern menu_info_t menu_info_cmdlist; | |
26 extern menu_info_t menu_info_pt; | |
27 extern menu_info_t menu_info_filesel; | |
28 extern menu_info_t menu_info_txt; | |
29 extern menu_info_t menu_info_console; | |
30 extern menu_info_t menu_info_pref; | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
10397
diff
changeset
|
31 #ifdef HAS_DVBIN_SUPPORT |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
10397
diff
changeset
|
32 extern menu_info_t menu_info_dvbsel; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
10397
diff
changeset
|
33 #endif |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
10397
diff
changeset
|
34 |
8197 | 35 |
36 menu_info_t* menu_info_list[] = { | |
37 &menu_info_pt, | |
38 &menu_info_cmdlist, | |
39 &menu_info_filesel, | |
40 &menu_info_txt, | |
41 &menu_info_console, | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
10397
diff
changeset
|
42 #ifdef HAS_DVBIN_SUPPORT |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
10397
diff
changeset
|
43 &menu_info_dvbsel, |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
10397
diff
changeset
|
44 #endif |
8197 | 45 &menu_info_pref, |
46 NULL | |
47 }; | |
48 | |
49 typedef struct menu_def_st { | |
50 char* name; | |
51 menu_info_t* type; | |
52 void* cfg; | |
53 char* args; | |
54 } menu_def_t; | |
55 | |
22284 | 56 static struct MPContext *menu_ctx = NULL; |
8197 | 57 static menu_def_t* menu_list = NULL; |
21797
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
58 static int menu_count = 0; |
8197 | 59 |
60 | |
61 static int menu_parse_config(char* buffer) { | |
62 char *element,*body, **attribs, *name; | |
63 menu_info_t* minfo = NULL; | |
64 int r,i; | |
65 ASX_Parser_t* parser = asx_parser_new(); | |
66 | |
67 while(1) { | |
68 r = asx_get_element(parser,&buffer,&element,&body,&attribs); | |
69 if(r < 0) { | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
70 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line); |
8197 | 71 asx_parser_free(parser); |
72 return 0; | |
73 } else if(r == 0) { | |
74 asx_parser_free(parser); | |
75 return 1; | |
76 } | |
77 // Has it a name ? | |
78 name = asx_get_attrib("name",attribs); | |
79 if(!name) { | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
80 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuDefinitionsNeedANameAttrib,parser->line); |
8197 | 81 free(element); |
82 if(body) free(body); | |
83 asx_free_attribs(attribs); | |
84 continue; | |
85 } | |
86 | |
87 // Try to find this menu type in our list | |
88 for(i = 0, minfo = NULL ; menu_info_list[i] ; i++) { | |
89 if(strcasecmp(element,menu_info_list[i]->name) == 0) { | |
90 minfo = menu_info_list[i]; | |
91 break; | |
92 } | |
93 } | |
94 // Got it : add this to our list | |
95 if(minfo) { | |
21797
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
96 menu_list = realloc(menu_list,(menu_count+2)*sizeof(menu_def_t)); |
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
97 menu_list[menu_count].name = name; |
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
98 menu_list[menu_count].type = minfo; |
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
99 menu_list[menu_count].cfg = m_struct_alloc(&minfo->priv_st); |
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
100 menu_list[menu_count].args = body; |
8197 | 101 // Setup the attribs |
102 for(i = 0 ; attribs[2*i] ; i++) { | |
103 if(strcasecmp(attribs[2*i],"name") == 0) continue; | |
21797
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
104 if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,attribs[2*i], attribs[2*i+1])) |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
105 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_BadAttrib,attribs[2*i],attribs[2*i+1], |
8197 | 106 name,parser->line); |
107 } | |
21797
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
108 menu_count++; |
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
109 memset(&menu_list[menu_count],0,sizeof(menu_def_t)); |
8197 | 110 } else { |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
111 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuType,element,parser->line); |
8197 | 112 free(name); |
113 if(body) free(body); | |
114 } | |
115 | |
116 free(element); | |
117 asx_free_attribs(attribs); | |
118 } | |
119 | |
120 } | |
121 | |
122 | |
123 /// This will build the menu_defs list from the cfg file | |
124 #define BUF_STEP 1024 | |
125 #define BUF_MIN 128 | |
126 #define BUF_MAX BUF_STEP*1024 | |
22284 | 127 int menu_init(struct MPContext *mpctx, char* cfg_file) { |
8197 | 128 char* buffer = NULL; |
129 int bl = BUF_STEP, br = 0; | |
9103
6c2c74adaebe
mplayer crashes if one tries to use osd menu without having a font
arpi
parents:
8604
diff
changeset
|
130 int f, fd; |
9212
24b102dbd0fe
Fixes a problem where the menu won't work, if you just use freetype fonts
arpi
parents:
9103
diff
changeset
|
131 #ifndef HAVE_FREETYPE |
9103
6c2c74adaebe
mplayer crashes if one tries to use osd menu without having a font
arpi
parents:
8604
diff
changeset
|
132 if(vo_font == NULL) |
6c2c74adaebe
mplayer crashes if one tries to use osd menu without having a font
arpi
parents:
8604
diff
changeset
|
133 return 0; |
9212
24b102dbd0fe
Fixes a problem where the menu won't work, if you just use freetype fonts
arpi
parents:
9103
diff
changeset
|
134 #endif |
9103
6c2c74adaebe
mplayer crashes if one tries to use osd menu without having a font
arpi
parents:
8604
diff
changeset
|
135 fd = open(cfg_file, O_RDONLY); |
8604
41a1e5dbb552
This patch fixes the reading of the menu.conf, because stream_open()
arpi
parents:
8251
diff
changeset
|
136 if(fd < 0) { |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
137 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantOpenConfigFile,cfg_file); |
8197 | 138 return 0; |
139 } | |
140 buffer = malloc(bl); | |
141 while(1) { | |
142 int r; | |
143 if(bl - br < BUF_MIN) { | |
144 if(bl >= BUF_MAX) { | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
145 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsTooBig,BUF_MAX/1024); |
8604
41a1e5dbb552
This patch fixes the reading of the menu.conf, because stream_open()
arpi
parents:
8251
diff
changeset
|
146 close(fd); |
8197 | 147 free(buffer); |
148 return 0; | |
149 } | |
150 bl += BUF_STEP; | |
151 buffer = realloc(buffer,bl); | |
152 } | |
8604
41a1e5dbb552
This patch fixes the reading of the menu.conf, because stream_open()
arpi
parents:
8251
diff
changeset
|
153 r = read(fd,buffer+br,bl-br); |
8197 | 154 if(r == 0) break; |
155 br += r; | |
156 } | |
157 if(!br) { | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
158 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsEmpty); |
8197 | 159 return 0; |
160 } | |
161 buffer[br-1] = '\0'; | |
162 | |
8604
41a1e5dbb552
This patch fixes the reading of the menu.conf, because stream_open()
arpi
parents:
8251
diff
changeset
|
163 close(fd); |
41a1e5dbb552
This patch fixes the reading of the menu.conf, because stream_open()
arpi
parents:
8251
diff
changeset
|
164 |
22284 | 165 menu_ctx = mpctx; |
8197 | 166 f = menu_parse_config(buffer); |
167 free(buffer); | |
168 return f; | |
169 } | |
170 | |
171 // Destroy all this stuff | |
172 void menu_unint(void) { | |
173 int i; | |
174 for(i = 0 ; menu_list && menu_list[i].name ; i++) { | |
175 free(menu_list[i].name); | |
176 m_struct_free(&menu_list[i].type->priv_st,menu_list[i].cfg); | |
177 if(menu_list[i].args) free(menu_list[i].args); | |
178 } | |
179 free(menu_list); | |
21797
14061bc22cb3
fix gprof support (aka work around gprof's brain dead design)
gpoirier
parents:
20507
diff
changeset
|
180 menu_count = 0; |
8197 | 181 } |
182 | |
183 /// Default read_key function | |
184 void menu_dflt_read_key(menu_t* menu,int cmd) { | |
185 switch(cmd) { | |
186 case KEY_UP: | |
187 menu->read_cmd(menu,MENU_CMD_UP); | |
188 break; | |
189 case KEY_DOWN: | |
190 menu->read_cmd(menu,MENU_CMD_DOWN); | |
191 break; | |
192 case KEY_LEFT: | |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
16862
diff
changeset
|
193 menu->read_cmd(menu,MENU_CMD_LEFT); |
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
16862
diff
changeset
|
194 break; |
8197 | 195 case KEY_ESC: |
196 menu->read_cmd(menu,MENU_CMD_CANCEL); | |
197 break; | |
198 case KEY_RIGHT: | |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
16862
diff
changeset
|
199 menu->read_cmd(menu,MENU_CMD_RIGHT); |
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
16862
diff
changeset
|
200 break; |
8197 | 201 case KEY_ENTER: |
202 menu->read_cmd(menu,MENU_CMD_OK); | |
203 break; | |
204 } | |
205 } | |
206 | |
207 menu_t* menu_open(char *name) { | |
208 menu_t* m; | |
209 int i; | |
210 | |
211 for(i = 0 ; menu_list[i].name != NULL ; i++) { | |
212 if(strcmp(name,menu_list[i].name) == 0) | |
213 break; | |
214 } | |
215 if(menu_list[i].name == NULL) { | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
216 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuNotFound,name); |
8197 | 217 return NULL; |
218 } | |
219 m = calloc(1,sizeof(menu_t)); | |
220 m->priv_st = &(menu_list[i].type->priv_st); | |
221 m->priv = m_struct_copy(m->priv_st,menu_list[i].cfg); | |
22284 | 222 m->ctx = menu_ctx; |
8197 | 223 if(menu_list[i].type->open(m,menu_list[i].args)) |
224 return m; | |
225 if(m->priv) | |
226 m_struct_free(m->priv_st,m->priv); | |
227 free(m); | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
228 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuInitFailed,name); |
8197 | 229 return NULL; |
230 } | |
231 | |
232 void menu_draw(menu_t* menu,mp_image_t* mpi) { | |
233 if(menu->show && menu->draw) | |
234 menu->draw(menu,mpi); | |
235 } | |
236 | |
237 void menu_read_cmd(menu_t* menu,int cmd) { | |
238 if(menu->read_cmd) | |
239 menu->read_cmd(menu,cmd); | |
240 } | |
241 | |
242 void menu_close(menu_t* menu) { | |
243 if(menu->close) | |
244 menu->close(menu); | |
245 if(menu->priv) | |
246 m_struct_free(menu->priv_st,menu->priv); | |
247 free(menu); | |
248 } | |
249 | |
250 void menu_read_key(menu_t* menu,int cmd) { | |
251 if(menu->read_key) | |
252 menu->read_key(menu,cmd); | |
253 else | |
254 menu_dflt_read_key(menu,cmd); | |
255 } | |
256 | |
257 ///////////////////////////// Helpers //////////////////////////////////// | |
258 | |
259 typedef void (*draw_alpha_f)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); | |
260 | |
261 inline static draw_alpha_f get_draw_alpha(uint32_t fmt) { | |
262 switch(fmt) { | |
263 case IMGFMT_BGR15: | |
264 case IMGFMT_RGB15: | |
265 return vo_draw_alpha_rgb15; | |
266 case IMGFMT_BGR16: | |
267 case IMGFMT_RGB16: | |
268 return vo_draw_alpha_rgb16; | |
269 case IMGFMT_BGR24: | |
270 case IMGFMT_RGB24: | |
271 return vo_draw_alpha_rgb24; | |
272 case IMGFMT_BGR32: | |
273 case IMGFMT_RGB32: | |
274 return vo_draw_alpha_rgb32; | |
275 case IMGFMT_YV12: | |
276 case IMGFMT_I420: | |
277 case IMGFMT_IYUV: | |
278 case IMGFMT_YVU9: | |
279 case IMGFMT_IF09: | |
280 case IMGFMT_Y800: | |
281 case IMGFMT_Y8: | |
282 return vo_draw_alpha_yv12; | |
283 case IMGFMT_YUY2: | |
284 return vo_draw_alpha_yuy2; | |
18194 | 285 case IMGFMT_UYVY: |
286 return vo_draw_alpha_uyvy; | |
8197 | 287 } |
288 | |
289 return NULL; | |
290 } | |
291 | |
8224
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
292 // return the real height of a char: |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
293 static inline int get_height(int c,int h){ |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
294 int font; |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
295 if ((font=vo_font->font[c])>=0) |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
296 if(h<vo_font->pic_a[font]->h) h=vo_font->pic_a[font]->h; |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
297 return h; |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
298 } |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
299 |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
300 int menu_utf8 = 0; |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
301 int menu_unicode = 0; |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
302 |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
303 static int get_next_char(char **txt) |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
304 { |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
305 int c; |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
306 c = (unsigned char)*(*txt)++; |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
307 if (c >= 0x80) { |
23232
c5ac43d53bb1
use already existing function to get utf8 char in libmenu (thx to reimar)
ben
parents:
23231
diff
changeset
|
308 if (menu_utf8) |
23237 | 309 c = utf8_get_char((const char**)txt); |
23232
c5ac43d53bb1
use already existing function to get utf8 char in libmenu (thx to reimar)
ben
parents:
23231
diff
changeset
|
310 else if (menu_unicode) |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
311 c = (c<<8) + (unsigned char)*(*txt)++; |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
312 } |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
313 if (!c) c++; // avoid UCS 0 |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
314 return c; |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
315 } |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
316 |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
317 static void render_txt(char *txt) |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
318 { |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
319 while (*txt) { |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
320 int c = get_next_char(&txt); |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
321 render_one_glyph(vo_font, c); |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
322 } |
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
323 } |
8197 | 324 |
23228
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
325 #ifdef USE_FRIBIDI |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
326 #include <fribidi/fribidi.h> |
23231 | 327 #include "libavutil/common.h" |
23238 | 328 char *menu_fribidi_charset = NULL; |
329 int menu_flip_hebrew = 0; | |
330 int menu_fribidi_flip_commas = 0; | |
23228
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
331 |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
332 static char *menu_fribidi(char *txt) |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
333 { |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
334 static int char_set_num = -1; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
335 static FriBidiChar *logical, *visual; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
336 static size_t buffer_size = 1024; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
337 static char *outputstr; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
338 |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
339 FriBidiCharType base; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
340 fribidi_boolean log2vis; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
341 size_t len; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
342 |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
343 if (menu_flip_hebrew) { |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
344 len = strlen(txt); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
345 if (char_set_num == -1) { |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
346 fribidi_set_mirroring (1); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
347 fribidi_set_reorder_nsm (0); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
348 if (menu_utf8 == 0) { |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
349 char_set_num = fribidi_parse_charset(menu_fribidi_charset ? menu_fribidi_charset : "ISO8859-8"); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
350 } else { |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
351 char_set_num = fribidi_parse_charset("UTF-8"); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
352 } |
23231 | 353 buffer_size = FFMAX(1024,len+1); |
23230 | 354 logical = malloc(buffer_size); |
355 visual = malloc(buffer_size); | |
356 outputstr = malloc(buffer_size); | |
23228
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
357 } else if (len+1 > buffer_size) { |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
358 buffer_size = len+1; |
23230 | 359 logical = realloc(logical, buffer_size); |
360 visual = realloc(visual, buffer_size); | |
361 outputstr = realloc(outputstr, buffer_size); | |
23228
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
362 } |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
363 len = fribidi_charset_to_unicode (char_set_num, txt, len, logical); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
364 base = menu_fribidi_flip_commas?FRIBIDI_TYPE_ON:FRIBIDI_TYPE_L; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
365 log2vis = fribidi_log2vis (logical, len, &base, visual, NULL, NULL, NULL); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
366 if (log2vis) { |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
367 len = fribidi_remove_bidi_marks (visual, len, NULL, NULL, NULL); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
368 fribidi_unicode_to_charset (char_set_num, visual, len, outputstr); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
369 return outputstr; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
370 } |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
371 } |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
372 return txt; |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
373 } |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
374 #endif |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
375 |
8197 | 376 void menu_draw_text(mp_image_t* mpi,char* txt, int x, int y) { |
377 draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt); | |
378 int font; | |
379 | |
380 if(!draw_alpha) { | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
381 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat); |
8197 | 382 return; |
383 } | |
384 | |
23228
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
385 #ifdef USE_FRIBIDI |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
386 txt = menu_fribidi(txt); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
387 #endif |
8224
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
388 render_txt(txt); |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
389 |
8197 | 390 while (*txt) { |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
391 int c=get_next_char(&txt); |
8197 | 392 if ((font=vo_font->font[c])>=0 && (x + vo_font->width[c] <= mpi->w) && (y + vo_font->pic_a[font]->h <= mpi->h)) |
393 draw_alpha(vo_font->width[c], vo_font->pic_a[font]->h, | |
394 vo_font->pic_b[font]->bmp+vo_font->start[c], | |
395 vo_font->pic_a[font]->bmp+vo_font->start[c], | |
396 vo_font->pic_a[font]->w, | |
397 mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3), | |
398 mpi->stride[0]); | |
399 x+=vo_font->width[c]+vo_font->charspace; | |
400 } | |
401 | |
402 } | |
403 | |
404 void menu_draw_text_full(mp_image_t* mpi,char* txt, | |
405 int x, int y,int w, int h, | |
406 int vspace, int warp, int align, int anchor) { | |
407 int need_w,need_h; | |
408 int sy, ymin, ymax; | |
409 int sx, xmin, xmax, xmid, xrmin; | |
410 int ll = 0; | |
411 int font; | |
412 draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt); | |
413 | |
414 if(!draw_alpha) { | |
17994
6927fabaef92
Part1 of several printf2mp_msg changes in patch from Otvos Attila oattila AT chello DOT hu
reynaldo
parents:
17993
diff
changeset
|
415 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat); |
8197 | 416 return; |
417 } | |
418 | |
23228
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
419 #ifdef USE_FRIBIDI |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
420 txt = menu_fribidi(txt); |
2e95dcd49946
support for hebrew through fribidi in libmenu (geexbox patch #580)
ben
parents:
23227
diff
changeset
|
421 #endif |
8224
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
422 render_txt(txt); |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
423 |
8197 | 424 if(x > mpi->w || y > mpi->h) |
425 return; | |
426 | |
427 if(anchor & MENU_TEXT_VCENTER) { | |
428 if(h <= 0) h = mpi->h; | |
429 ymin = y - h/2; | |
430 ymax = y + h/2; | |
431 } else if(anchor & MENU_TEXT_BOT) { | |
432 if(h <= 0) h = mpi->h - y; | |
433 ymin = y - h; | |
434 ymax = y; | |
435 } else { | |
436 if(h <= 0) h = mpi->h - y; | |
437 ymin = y; | |
438 ymax = y + h; | |
439 } | |
440 | |
441 if(anchor & MENU_TEXT_HCENTER) { | |
442 if(w <= 0) w = mpi->w; | |
443 xmin = x - w/2; | |
444 xmax = x + w/2; | |
445 } else if(anchor & MENU_TEXT_RIGHT) { | |
446 if(w <= 0) w = mpi->w -x; | |
447 xmin = x - w; | |
448 xmax = x; | |
449 } else { | |
450 if(w <= 0) w = mpi->w -x; | |
451 xmin = x; | |
452 xmax = x + w; | |
453 } | |
454 | |
455 // How many space do we need to draw this ? | |
456 menu_text_size(txt,w,vspace,warp,&need_w,&need_h); | |
457 | |
458 // Find the first line | |
459 if(align & MENU_TEXT_VCENTER) | |
460 sy = ymin + ((h - need_h)/2); | |
461 else if(align & MENU_TEXT_BOT) | |
8232 | 462 sy = ymax - need_h - 1; |
8197 | 463 else |
464 sy = y; | |
465 | |
466 #if 0 | |
467 // Find the first col | |
468 if(align & MENU_TEXT_HCENTER) | |
469 sx = xmin + ((w - need_w)/2); | |
470 else if(align & MENU_TEXT_RIGHT) | |
471 sx = xmax - need_w; | |
472 #endif | |
473 | |
474 xmid = xmin + (xmax - xmin) / 2; | |
475 xrmin = xmin; | |
476 // Clamp the bb to the mpi size | |
477 if(ymin < 0) ymin = 0; | |
478 if(xmin < 0) xmin = 0; | |
479 if(ymax > mpi->h) ymax = mpi->h; | |
480 if(xmax > mpi->w) xmax = mpi->w; | |
481 | |
482 // Jump some the beginnig text if needed | |
483 while(sy < ymin && *txt) { | |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
484 int c=get_next_char(&txt); |
8197 | 485 if(c == '\n' || (warp && ll + vo_font->width[c] > w)) { |
486 ll = 0; | |
487 sy += vo_font->height + vspace; | |
488 if(c == '\n') continue; | |
489 } | |
490 ll += vo_font->width[c]+vo_font->charspace; | |
491 } | |
492 if(*txt == '\0') // Nothing left to draw | |
493 return; | |
494 | |
495 while(sy < ymax && *txt) { | |
496 char* line_end = NULL; | |
497 int n; | |
498 | |
499 if(txt[0] == '\n') { // New line | |
500 sy += vo_font->height + vspace; | |
501 txt++; | |
502 continue; | |
503 } | |
504 | |
505 // Get the length and end of this line | |
506 for(n = 0, ll = 0 ; txt[n] != '\0' && txt[n] != '\n' ; n++) { | |
507 unsigned char c = txt[n]; | |
508 if(warp && ll + vo_font->width[c] > w) break; | |
509 ll += vo_font->width[c]+vo_font->charspace; | |
510 } | |
511 line_end = &txt[n]; | |
512 ll -= vo_font->charspace; | |
513 | |
514 | |
515 if(align & (MENU_TEXT_HCENTER|MENU_TEXT_RIGHT)) { | |
516 // Too long line | |
517 if(ll > xmax-xmin) { | |
518 if(align & MENU_TEXT_HCENTER) { | |
519 int mid = ll/2; | |
520 // Find the middle point | |
521 for(n--, ll = 0 ; n <= 0 ; n--) { | |
522 ll += vo_font->width[(int)txt[n]]+vo_font->charspace; | |
523 if(ll - vo_font->charspace > mid) break; | |
524 } | |
525 ll -= vo_font->charspace; | |
526 sx = xmid + mid - ll; | |
527 } else// MENU_TEXT_RIGHT) | |
528 sx = xmax + vo_font->charspace; | |
529 | |
530 // We are after the start point -> go back | |
531 if(sx > xmin) { | |
532 for(n-- ; n <= 0 ; n--) { | |
533 unsigned char c = txt[n]; | |
534 if(sx - vo_font->width[c] - vo_font->charspace < xmin) break; | |
535 sx -= vo_font->width[c]+vo_font->charspace; | |
536 } | |
537 } else { // We are before the start point -> go forward | |
538 for( ; sx < xmin && (&txt[n]) != line_end ; n++) { | |
539 unsigned char c = txt[n]; | |
540 sx += vo_font->width[c]+vo_font->charspace; | |
541 } | |
542 } | |
543 txt = &txt[n]; // Jump to the new start char | |
544 } else { | |
545 if(align & MENU_TEXT_HCENTER) | |
546 sx = xmid - ll/2; | |
547 else | |
8232 | 548 sx = xmax - 1 - ll; |
8197 | 549 } |
550 } else { | |
551 for(sx = xrmin ; sx < xmin && txt != line_end ; txt++) { | |
552 unsigned char c = txt[n]; | |
553 sx += vo_font->width[c]+vo_font->charspace; | |
554 } | |
555 } | |
556 | |
557 while(sx < xmax && txt != line_end) { | |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
558 int c=get_next_char(&txt); |
8197 | 559 font = vo_font->font[c]; |
8232 | 560 if(font >= 0) { |
561 int cs = (vo_font->pic_a[font]->h - vo_font->height) / 2; | |
562 if ((sx + vo_font->width[c] < xmax) && (sy + vo_font->height < ymax) ) | |
563 draw_alpha(vo_font->width[c], vo_font->height, | |
564 vo_font->pic_b[font]->bmp+vo_font->start[c] + | |
565 cs * vo_font->pic_a[font]->w, | |
566 vo_font->pic_a[font]->bmp+vo_font->start[c] + | |
567 cs * vo_font->pic_a[font]->w, | |
568 vo_font->pic_a[font]->w, | |
569 mpi->planes[0] + sy * mpi->stride[0] + sx * (mpi->bpp>>3), | |
570 mpi->stride[0]); | |
571 // else | |
572 //printf("Can't draw '%c'\n",c); | |
573 } | |
8197 | 574 sx+=vo_font->width[c]+vo_font->charspace; |
575 } | |
576 txt = line_end; | |
577 if(txt[0] == '\0') break; | |
578 sy += vo_font->height + vspace; | |
579 } | |
580 } | |
581 | |
582 int menu_text_length(char* txt) { | |
583 int l = 0; | |
8224
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
584 render_txt(txt); |
8197 | 585 while (*txt) { |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
586 int c=get_next_char(&txt); |
8197 | 587 l += vo_font->width[c]+vo_font->charspace; |
588 } | |
589 return l - vo_font->charspace; | |
590 } | |
591 | |
592 void menu_text_size(char* txt,int max_width, int vspace, int warp, int* _w, int* _h) { | |
593 int l = 1, i = 0; | |
594 int w = 0; | |
8224
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
595 |
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
596 render_txt(txt); |
8197 | 597 while (*txt) { |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
598 int c=get_next_char(&txt); |
8197 | 599 if(c == '\n' || (warp && i + vo_font->width[c] >= max_width)) { |
600 if(*txt) | |
601 l++; | |
602 i = 0; | |
603 if(c == '\n') continue; | |
604 } | |
605 i += vo_font->width[c]+vo_font->charspace; | |
606 if(i > w) w = i; | |
607 } | |
608 | |
609 *_w = w; | |
610 *_h = (l-1) * (vo_font->height + vspace) + vo_font->height; | |
611 } | |
612 | |
613 | |
614 int menu_text_num_lines(char* txt, int max_width) { | |
615 int l = 1, i = 0; | |
8224
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
616 render_txt(txt); |
8197 | 617 while (*txt) { |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
618 int c=get_next_char(&txt); |
8197 | 619 if(c == '\n' || i + vo_font->width[c] > max_width) { |
620 l++; | |
621 i = 0; | |
622 if(c == '\n') continue; | |
623 } | |
624 i += vo_font->width[c]+vo_font->charspace; | |
625 } | |
626 return l; | |
627 } | |
628 | |
629 char* menu_text_get_next_line(char* txt, int max_width) { | |
630 int i = 0; | |
8224
fefc56153615
Fix freetype. Freetype is highly recommended for a nice output ;)
albeu
parents:
8197
diff
changeset
|
631 render_txt(txt); |
8197 | 632 while (*txt) { |
23227
a142b048c65e
support for unicode/utf8 in libmenu (geexbox patch #545)
ben
parents:
22284
diff
changeset
|
633 int c=get_next_char(&txt); |
8197 | 634 if(c == '\n') { |
635 txt++; | |
636 break; | |
637 } | |
638 i += vo_font->width[c]; | |
639 if(i >= max_width) | |
640 break; | |
641 i += vo_font->charspace; | |
642 } | |
643 return txt; | |
644 } | |
17993
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
645 |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
646 |
18193 | 647 void menu_draw_box(mp_image_t* mpi,unsigned char grey,unsigned char alpha, int x, int y, int w, int h) { |
17993
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
648 draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt); |
18193 | 649 int g; |
17993
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
650 |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
651 if(!draw_alpha) { |
18193 | 652 mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat); |
17993
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
653 return; |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
654 } |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
655 |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
656 if(x > mpi->w || y > mpi->h) return; |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
657 |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
658 if(x < 0) w += x, x = 0; |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
659 if(x+w > mpi->w) w = mpi->w-x; |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
660 if(y < 0) h += y, y = 0; |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
661 if(y+h > mpi->h) h = mpi->h-y; |
18193 | 662 |
663 g = ((256-alpha)*grey)>>8; | |
664 if(g < 1) g = 1; | |
665 | |
17993
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
666 { |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
667 int stride = (w+7)&(~7); // round to 8 |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
668 char pic[stride*h],pic_alpha[stride*h]; |
18193 | 669 memset(pic,g,stride*h); |
17993
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
670 memset(pic_alpha,alpha,stride*h); |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
671 draw_alpha(w,h,pic,pic_alpha,stride, |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
672 mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3), |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
673 mpi->stride[0]); |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
674 } |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
675 |
98eb966a4024
Add a function to draw flat boxes and use it to make the list
albeu
parents:
17945
diff
changeset
|
676 } |