Mercurial > mplayer.hg
annotate libvo/vo_svga.c @ 1881:d75b24bda7ce
Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
author | atmos4 |
---|---|
date | Tue, 11 Sep 2001 16:26:41 +0000 |
parents | d3364cc1f792 |
children | 71934dc06490 |
rev | line source |
---|---|
285 | 1 /* |
292 | 2 Video driver for SVGAlib - alpha, slow |
285 | 3 by Zoltan Mark Vician <se7en@sch.bme.hu> |
381 | 4 Code started: Mon Apr 1 23:25:47 2001 |
407 | 5 |
6 Uses HW acceleration if your card is supported by SVGAlib. | |
285 | 7 */ |
8 | |
9 #include <stdio.h> | |
10 #include <stdlib.h> | |
11 | |
12 #include <vga.h> | |
13 #include <vgagl.h> | |
14 | |
485 | 15 #include <limits.h> |
16 | |
285 | 17 #include "config.h" |
18 #include "video_out.h" | |
19 #include "video_out_internal.h" | |
20 | |
21 #include "yuv2rgb.h" | |
1339 | 22 #ifdef HAVE_MMX |
377 | 23 #include "mmx.h" |
1339 | 24 #endif |
285 | 25 |
616 | 26 #include "sub.h" |
27 | |
407 | 28 extern void rgb15to16_mmx(char* s0,char* d0,int count); |
485 | 29 extern int vo_dbpp; |
504 | 30 extern int verbose; |
407 | 31 |
285 | 32 LIBVO_EXTERN(svga) |
33 | |
34 static vo_info_t vo_info = { | |
35 "SVGAlib", | |
36 "svga", | |
37 "Zoltan Mark Vician <se7en@sch.bme.hu>", | |
38 "" | |
39 }; | |
40 | |
41 // SVGAlib definitions | |
42 | |
43 GraphicsContext *screen; | |
44 GraphicsContext *virt; | |
45 | |
407 | 46 static uint8_t *scalebuf = NULL, *yuvbuf = NULL, *bppbuf = NULL; |
285 | 47 |
48 static uint32_t orig_w, orig_h, maxw, maxh; // Width, height | |
377 | 49 static float scaling = 1.0; |
285 | 50 static uint32_t x_pos, y_pos; // Position |
51 | |
483 | 52 // SVGAlib - list of detected modes |
53 typedef struct vga_modelist_s { | |
54 uint16_t modenum; | |
55 vga_modeinfo modeinfo; | |
56 struct vga_modelist_s *next; | |
57 } vga_modelist_t; | |
447 | 58 |
483 | 59 vga_modelist_t *modelist = NULL; |
60 | |
327 | 61 static uint8_t bpp; |
483 | 62 static uint8_t bpp_conv = 0; |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
447
diff
changeset
|
63 static uint32_t pformat; |
447 | 64 |
483 | 65 #define BPP_15 1 |
66 #define BPP_16 2 | |
67 #define BPP_24 4 | |
68 #define BPP_32 8 | |
69 static uint8_t bpp_avail = 0; | |
70 | |
285 | 71 static uint8_t checked = 0; |
483 | 72 |
485 | 73 static uint32_t add_mode(uint16_t mode, vga_modeinfo minfo) { |
483 | 74 vga_modelist_t *list; |
285 | 75 |
483 | 76 if (modelist == NULL) { |
485 | 77 modelist = (vga_modelist_t *) malloc(sizeof(vga_modelist_t)); |
483 | 78 if (modelist == NULL) { |
79 printf("vo_svga: add_mode() failed. Not enough memory for modelist."); | |
80 return(1); // error | |
81 } | |
485 | 82 modelist->modenum = mode; |
83 modelist->modeinfo = minfo; | |
84 modelist->next = NULL; | |
483 | 85 } else { |
86 list = modelist; | |
87 while (list->next != NULL) | |
88 list = list->next; | |
485 | 89 list->next = (vga_modelist_t *) malloc(sizeof(vga_modelist_t)); |
483 | 90 if (list->next == NULL) { |
91 printf("vo_svga: add_mode() failed. Not enough memory for modelist."); | |
92 return(1); // error | |
93 } | |
94 list = list->next; | |
95 list->modenum = mode; | |
96 list->modeinfo = minfo; | |
97 list->next = NULL; | |
98 } | |
485 | 99 return (0); |
483 | 100 } |
101 | |
102 static int checksupportedmodes() { | |
485 | 103 uint16_t i, max; |
483 | 104 vga_modeinfo *minfo; |
285 | 105 |
106 checked = 1; | |
107 vga_init(); | |
108 vga_disabledriverreport(); | |
485 | 109 max = vga_lastmodenumber(); |
110 for (i = 1; i < max; i++) | |
483 | 111 if (vga_hasmode(i) > 0) { |
112 minfo = vga_getmodeinfo(i); | |
113 switch (minfo->colors) { | |
114 case 32768: bpp_avail |= BPP_15; break; | |
115 case 65536: bpp_avail |= BPP_16; break; | |
116 } | |
117 switch (minfo->bytesperpixel) { | |
118 case 3: bpp_avail |= BPP_24; break; | |
119 case 4: bpp_avail |= BPP_32; break; | |
120 } | |
504 | 121 if (verbose >= 2) |
122 printf("vo_svga: Mode found: %s\n",vga_getmodename(i)); | |
483 | 123 if (add_mode(i, *minfo)) |
124 return(1); | |
125 } | |
485 | 126 return(0); |
285 | 127 } |
128 | |
129 static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, | |
130 uint32_t d_height, uint32_t fullscreen, char *title, | |
131 uint32_t format) { | |
483 | 132 uint32_t req_w = (d_width > 0 ? d_width : width); |
133 uint32_t req_h = (d_height > 0 ? d_height : height); | |
134 uint16_t vid_mode = 0; | |
976 | 135 uint8_t res_widescr, vid_widescr = (((req_w*1.0)/req_h) > (4.0/3)) ? 1 : 0; |
485 | 136 uint16_t buf_w = USHRT_MAX, buf_h = USHRT_MAX; |
483 | 137 vga_modelist_t *list = modelist; |
387 | 138 |
285 | 139 if (!checked) { |
485 | 140 if (checksupportedmodes()) // Looking for available video modes |
483 | 141 return(1); |
285 | 142 } |
407 | 143 |
483 | 144 bpp_avail = 0; |
145 while (list != NULL) { | |
146 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) { | |
147 switch (list->modeinfo.colors) { | |
148 case 32768: bpp_avail |= BPP_15; break; | |
149 case 65536: bpp_avail |= BPP_16; break; | |
150 } | |
151 switch (list->modeinfo.bytesperpixel) { | |
152 case 3: bpp_avail |= BPP_24; break; | |
153 case 4: bpp_avail |= BPP_32; break; | |
154 } | |
155 } | |
156 list = list->next; | |
157 } | |
158 | |
285 | 159 pformat = format; |
411 | 160 |
483 | 161 // bpp check |
162 bpp_conv = 0; | |
411 | 163 if (!vo_dbpp) { |
164 if (format == IMGFMT_YV12) bpp = 32; | |
165 else bpp = format & 255; | |
504 | 166 if (verbose) |
167 printf("vo_svga: vo_dbpp == 0, bpp: %d\n",bpp); | |
483 | 168 switch (bpp) { |
169 case 32: if (!(bpp_avail & BPP_32)) { | |
170 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
485 | 171 printf("vo_svga: Maybe you should try -bpp\n"); |
483 | 172 return(1); |
173 } | |
174 break; | |
619 | 175 case 24: if (!(bpp_avail & BPP_24)) { |
483 | 176 if (!(bpp_avail & BPP_32)) { |
177 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
485 | 178 printf("vo_svga: Maybe you should try -bpp\n"); |
483 | 179 return(1); |
180 } else { | |
181 bpp = 32; | |
182 bpp_conv = 1; | |
617 | 183 printf("vo_svga: BPP conversion 24->32\n"); |
619 | 184 } |
185 } | |
483 | 186 break; |
187 case 16: if (!(bpp_avail & BPP_16)) { | |
188 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
189 printf("vo_svga: Maybe you should try -bpp\n"); | |
190 return(1); | |
191 } | |
192 break; | |
619 | 193 case 15: if (!(bpp_avail & BPP_15)) { |
483 | 194 if (!(bpp_avail & BPP_16)) { |
195 printf("vo_svga: Haven't found video mode which fit to: %dx%d %dbpp\n",req_w,req_h,bpp); | |
196 printf("vo_svga: Maybe you should try -bpp\n"); | |
197 return(1); | |
198 } else { | |
199 bpp = 16; | |
200 bpp_conv = 1; | |
617 | 201 printf("vo_svga: BPP conversion 15->16\n"); |
483 | 202 } |
619 | 203 } |
483 | 204 break; |
205 } | |
411 | 206 } else { |
207 bpp = vo_dbpp; | |
504 | 208 if (verbose) |
209 printf("vo_svga: vo_dbpp == %d\n",bpp); | |
411 | 210 switch (bpp) { |
483 | 211 case 32: if (!(bpp_avail & BPP_32)) { |
485 | 212 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 213 return(1); |
214 } | |
485 | 215 break; |
483 | 216 case 24: if (!(bpp_avail & BPP_24)) { |
485 | 217 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 218 return(1); |
219 } | |
485 | 220 break; |
483 | 221 case 16: if (!(bpp_avail & BPP_16)) { |
485 | 222 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 223 return(1); |
224 } | |
485 | 225 break; |
483 | 226 case 15: if (!(bpp_avail & BPP_15)) { |
485 | 227 printf("vo_svga: %dbpp not supported in %dx%d (or larger resoltuion) by HW or SVGAlib\n",bpp,req_w,req_h); |
411 | 228 return(1); |
229 } | |
485 | 230 break; |
411 | 231 } |
232 } | |
483 | 233 |
234 list = modelist; | |
504 | 235 if (verbose) { |
236 printf("vo_svga: Looking for the best resolution...\n"); | |
237 printf("vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,bpp); | |
238 } | |
485 | 239 while (list != NULL) { |
483 | 240 if ((list->modeinfo.width >= req_w) && (list->modeinfo.height >= req_h)) { |
504 | 241 if (verbose) { |
242 switch (list->modeinfo.colors) { | |
243 case 32768: printf("vo_svga: vid_mode: %d, %dx%d 15bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height); | |
244 break; | |
245 case 65536: printf("vo_svga: vid_mode: %d, %dx%d 16bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height); | |
246 break; | |
247 } | |
248 switch (list->modeinfo.bytesperpixel) { | |
249 case 3: printf("vo_svga: vid_mode: %d, %dx%d 24bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height); | |
250 break; | |
251 case 4: printf("vo_svga: vid_mode: %d, %dx%d 32bpp\n",list->modenum,list->modeinfo.width,list->modeinfo.height); | |
252 break; | |
253 } | |
254 } | |
285 | 255 switch (bpp) { |
483 | 256 case 32: if (list->modeinfo.bytesperpixel == 4) |
485 | 257 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
258 vid_mode = list->modenum; | |
259 buf_w = list->modeinfo.width; | |
260 buf_h = list->modeinfo.height; | |
976 | 261 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 262 } |
263 break; | |
483 | 264 case 24: if (list->modeinfo.bytesperpixel == 3) |
485 | 265 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
266 vid_mode = list->modenum; | |
267 buf_w = list->modeinfo.width; | |
268 buf_h = list->modeinfo.height; | |
976 | 269 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 270 } |
271 break; | |
483 | 272 case 16: if (list->modeinfo.colors == 65536) |
485 | 273 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
274 vid_mode = list->modenum; | |
275 buf_w = list->modeinfo.width; | |
276 buf_h = list->modeinfo.height; | |
976 | 277 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 278 } |
279 break; | |
483 | 280 case 15: if (list->modeinfo.colors == 32768) |
485 | 281 if ((list->modeinfo.width < buf_w) || (list->modeinfo.height < buf_h)) { |
282 vid_mode = list->modenum; | |
283 buf_w = list->modeinfo.width; | |
284 buf_h = list->modeinfo.height; | |
976 | 285 res_widescr = (((buf_w*1.0)/buf_h) > (4.0/3)) ? 1 : 0; |
485 | 286 } |
287 break; | |
285 | 288 } |
483 | 289 } |
290 list = list->next; | |
407 | 291 } |
485 | 292 |
504 | 293 if (verbose) |
294 printf("vo_svga: vid_mode: %d\n",vid_mode); | |
407 | 295 vga_setlinearaddressing(); |
485 | 296 if (vga_setmode(vid_mode) == -1) { |
286 | 297 printf("vo_svga: vga_setmode(%d) failed.\n",vid_mode); |
483 | 298 uninit(); |
285 | 299 return(1); // error |
485 | 300 } |
301 if (gl_setcontextvga(vid_mode)) { | |
286 | 302 printf("vo_svga: gl_setcontextvga(%d) failed.\n",vid_mode); |
483 | 303 uninit(); |
285 | 304 return(1); // error |
286 | 305 } |
285 | 306 screen = gl_allocatecontext(); |
307 gl_getcontext(screen); | |
485 | 308 if (gl_setcontextvgavirtual(vid_mode)) { |
286 | 309 printf("vo_svga: gl_setcontextvgavirtual(%d) failed.\n",vid_mode); |
483 | 310 uninit(); |
285 | 311 return(1); // error |
286 | 312 } |
285 | 313 virt = gl_allocatecontext(); |
314 gl_getcontext(virt); | |
315 gl_setcontext(virt); | |
316 gl_clearscreen(0); | |
317 | |
485 | 318 if (bpp_conv) { |
483 | 319 bppbuf = malloc(maxw * maxh * BYTESPERPIXEL); |
485 | 320 if (bppbuf == NULL) { |
321 printf("vo_svga: bppbuf -> Not enough memory for buffering!\n"); | |
322 uninit(); | |
323 return (1); | |
324 } | |
483 | 325 } |
326 | |
285 | 327 orig_w = width; |
328 orig_h = height; | |
976 | 329 if ((fullscreen & 0x04) && (WIDTH != orig_w) && (HEIGHT != orig_h)) { |
330 if (!vid_widescr || !res_widescr) { | |
292 | 331 maxh = HEIGHT; |
332 scaling = maxh / (orig_h * 1.0); | |
333 maxw = (uint32_t) (orig_w * scaling); | |
334 scalebuf = malloc(maxw * maxh * BYTESPERPIXEL); | |
483 | 335 if (scalebuf == NULL) { |
485 | 336 printf("vo_svga: scalebuf -> Not enough memory for buffering!\n"); |
407 | 337 uninit(); |
338 return (1); | |
339 } | |
292 | 340 } else { |
341 maxw = WIDTH; | |
342 scaling = maxw / (orig_w * 1.0); | |
343 maxh = (uint32_t) (orig_h * scaling); | |
344 scalebuf = malloc(maxw * maxh * BYTESPERPIXEL); | |
483 | 345 if (scalebuf == NULL) { |
485 | 346 printf("vo_svga: scalebuf -> Not enough memory for buffering!\n"); |
407 | 347 uninit(); |
348 return (1); | |
349 } | |
292 | 350 } |
285 | 351 } else { |
352 maxw = orig_w; | |
353 maxh = orig_h; | |
354 } | |
355 x_pos = (WIDTH - maxw) / 2; | |
356 y_pos = (HEIGHT - maxh) / 2; | |
357 | |
358 if (pformat == IMGFMT_YV12) { | |
359 yuv2rgb_init(bpp, MODE_RGB); | |
360 yuvbuf = malloc(maxw * maxh * BYTESPERPIXEL); | |
483 | 361 if (yuvbuf == NULL) { |
485 | 362 printf("vo_svga: yuvbuf -> Not enough memory for buffering!\n"); |
407 | 363 uninit(); |
364 return (1); | |
365 } | |
285 | 366 } |
377 | 367 |
504 | 368 printf("vo_svga: SVGAlib resolution: %dx%d %dbpp - ", WIDTH, HEIGHT, bpp); |
293 | 369 if (maxw != orig_w || maxh != orig_h) printf("Video scaled to: %dx%d\n",maxw,maxh); |
285 | 370 else printf("No video scaling\n"); |
371 | |
372 return (0); | |
373 } | |
374 | |
375 static uint32_t query_format(uint32_t format) { | |
485 | 376 uint32_t res = 0; |
407 | 377 |
483 | 378 if (!checked) { |
379 if (checksupportedmodes()) // Looking for available video modes | |
380 return(0); | |
381 } | |
485 | 382 |
383 // if (vo_dbpp) => There is NO conversion!!! | |
384 if (vo_dbpp) { | |
712 | 385 if (format == IMGFMT_YV12) return (1); |
485 | 386 switch (vo_dbpp) { |
488 | 387 case 32: if ((format == IMGFMT_RGB32) || (format == IMGFMT_BGR32)) |
485 | 388 return ((bpp_avail & BPP_32) ? 1 : 0); |
389 break; | |
488 | 390 case 24: if ((format == IMGFMT_RGB24) || (format == IMGFMT_BGR24)) |
485 | 391 return ((bpp_avail & BPP_24) ? 1 : 0); |
392 break; | |
488 | 393 case 16: if ((format == IMGFMT_RGB16) || (format == IMGFMT_BGR16)) |
485 | 394 return ((bpp_avail & BPP_16) ? 1 : 0); |
395 break; | |
488 | 396 case 15: if ((format == IMGFMT_RGB15) || (format == IMGFMT_BGR15)) |
485 | 397 return ((bpp_avail & BPP_15) ? 1 : 0); |
398 break; | |
407 | 399 } |
488 | 400 } else { |
485 | 401 switch (format) { |
402 case IMGFMT_RGB32: | |
488 | 403 case IMGFMT_BGR32: return ((bpp_avail & BPP_32) ? 1 : 0); break; |
485 | 404 case IMGFMT_RGB24: |
488 | 405 case IMGFMT_BGR24: { |
485 | 406 res = (bpp_avail & BPP_24) ? 1 : 0; |
407 if (!res) | |
408 res = (bpp_avail & BPP_32) ? 1 : 0; | |
409 return (res); | |
410 } break; | |
411 case IMGFMT_RGB16: | |
488 | 412 case IMGFMT_BGR16: return ((bpp_avail & BPP_16) ? 1 : 0); break; |
485 | 413 case IMGFMT_RGB15: |
488 | 414 case IMGFMT_BGR15: { |
485 | 415 res = (bpp_avail & BPP_15) ? 1 : 0; |
416 if (!res) | |
417 res = (bpp_avail & BPP_16) ? 1 : 0; | |
418 return (res); | |
419 } break; | |
420 case IMGFMT_YV12: return (1); break; | |
285 | 421 } |
488 | 422 } |
285 | 423 return (0); |
424 } | |
425 | |
426 static const vo_info_t* get_info(void) { | |
427 return (&vo_info); | |
428 } | |
429 | |
430 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, | |
431 unsigned char *srca, int stride) { | |
327 | 432 switch (bpp) { |
433 case 32: | |
434 vo_draw_alpha_rgb32(w, h, src, srca, stride, virt->vbuf+4*(y0*WIDTH+x0), 4*WIDTH); | |
435 break; | |
436 case 24: | |
437 vo_draw_alpha_rgb24(w, h, src, srca, stride, virt->vbuf+3*(y0*WIDTH+x0), 3*WIDTH); | |
438 break; | |
439 case 16: | |
440 vo_draw_alpha_rgb16(w, h, src, srca, stride, virt->vbuf+2*(y0*WIDTH+x0), 2*WIDTH); | |
441 break; | |
442 case 15: | |
443 vo_draw_alpha_rgb15(w, h, src, srca, stride, virt->vbuf+2*(y0*WIDTH+x0), 2*WIDTH); | |
444 break; | |
445 } | |
285 | 446 } |
447 | |
448 static uint32_t draw_frame(uint8_t *src[]) { | |
449 if (pformat == IMGFMT_YV12) { | |
450 yuv2rgb(yuvbuf, src[0], src[1], src[2], orig_w, orig_h, orig_w * BYTESPERPIXEL, orig_w, orig_w / 2); | |
451 src[0] = yuvbuf; | |
452 } | |
483 | 453 if (scalebuf != NULL) { |
285 | 454 gl_scalebox(orig_w, orig_h, src[0], maxw, maxh, scalebuf); |
455 src[0] = scalebuf; | |
456 } | |
407 | 457 if (bpp_conv) { |
458 switch(bpp) { | |
485 | 459 case 32: { |
620 | 460 uint8_t *source = src[0]; |
461 uint8_t *dest = bppbuf; | |
462 register uint32_t i = 0; | |
502 | 463 |
620 | 464 while (i < (maxw * maxh * 4)) { |
465 dest[i] = source[i]; | |
466 dest[i+1] = source[i+1]; | |
467 dest[i+2] = source[i+2]; | |
468 dest[i+3] = 0; | |
469 i += 4; | |
407 | 470 } |
485 | 471 } break; |
472 case 16: { | |
407 | 473 #ifdef HAVE_MMX |
474 rgb15to16_mmx(src[0],bppbuf,maxw * maxh * 2); | |
475 #else | |
502 | 476 uint16_t *source = (uint16_t *) src[0]; |
477 uint16_t *dest = (uint16_t *) bppbuf; | |
620 | 478 register uint32_t i = 0; |
407 | 479 register uint16_t srcdata; |
480 | |
620 | 481 while (i < (maxw * maxh)) { |
482 srcdata = source[i]; | |
483 dest[i++] = (srcdata & 0x1f) | ((srcdata & 0x7fe0) << 1); | |
407 | 484 } |
485 #endif | |
485 | 486 } break; |
407 | 487 } |
488 src[0] = bppbuf; | |
489 } | |
285 | 490 gl_putbox(x_pos, y_pos, maxw, maxh, src[0]); |
617 | 491 |
492 return (0); | |
285 | 493 } |
494 | |
495 static uint32_t draw_slice(uint8_t *image[], int stride[], | |
496 int w, int h, int x, int y) { | |
497 uint8_t *src = yuvbuf; | |
377 | 498 uint32_t sw, sh; |
499 | |
875 | 500 yuv2rgb(yuvbuf, image[0], image[1], image[2], w, h, orig_w * BYTESPERPIXEL, stride[0], stride[1]); |
377 | 501 sw = (uint32_t) (w * scaling); |
502 sh = (uint32_t) (h * scaling); | |
483 | 503 if (scalebuf != NULL) { |
377 | 504 gl_scalebox(w, h, yuvbuf, sw, sh, scalebuf); |
285 | 505 src = scalebuf; |
506 } | |
377 | 507 gl_putbox((int)(x * scaling) + x_pos, (int)(y * scaling) + y_pos, sw, sh, src); |
617 | 508 |
509 return (0); | |
285 | 510 } |
511 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
512 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
513 { |
292 | 514 if (y_pos) { |
515 gl_fillbox(0, 0, WIDTH, y_pos, 0); | |
516 gl_fillbox(0, HEIGHT - y_pos, WIDTH, y_pos, 0); | |
1512
d3364cc1f792
small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents:
1501
diff
changeset
|
517 if (x_pos) { |
d3364cc1f792
small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents:
1501
diff
changeset
|
518 int hmy=HEIGHT - (y_pos<<1); |
d3364cc1f792
small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents:
1501
diff
changeset
|
519 gl_fillbox(0, y_pos, x_pos, hmy, 0); |
d3364cc1f792
small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents:
1501
diff
changeset
|
520 gl_fillbox(WIDTH - x_pos, y_pos, x_pos, hmy, 0); |
d3364cc1f792
small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents:
1501
diff
changeset
|
521 } |
d3364cc1f792
small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents:
1501
diff
changeset
|
522 } else if (x_pos) { |
d3364cc1f792
small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents:
1501
diff
changeset
|
523 gl_fillbox(0, y_pos, x_pos, HEIGHT, 0); |
d3364cc1f792
small changes to erase only needed place (rectangles doesn't overlap)
atlka
parents:
1501
diff
changeset
|
524 gl_fillbox(WIDTH - x_pos, y_pos, x_pos, HEIGHT, 0); |
989 | 525 } |
526 | |
486 | 527 vo_draw_text(WIDTH, HEIGHT, draw_alpha); |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
528 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
529 |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
530 static void flip_page(void) { |
285 | 531 gl_copyscreen(screen); |
532 } | |
533 | |
534 static void check_events(void) { | |
535 } | |
536 | |
537 static void uninit(void) { | |
483 | 538 vga_modelist_t *list = modelist; |
539 | |
285 | 540 gl_freecontext(screen); |
541 gl_freecontext(virt); | |
542 vga_setmode(TEXT); | |
483 | 543 if (bppbuf != NULL) |
407 | 544 free(bppbuf); |
483 | 545 if (scalebuf != NULL) |
285 | 546 free(scalebuf); |
483 | 547 if (yuvbuf != NULL) |
285 | 548 free(yuvbuf); |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
549 while (modelist != NULL) { |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
550 list=modelist; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
551 modelist=modelist->next; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1339
diff
changeset
|
552 free(list); |
483 | 553 } |
285 | 554 } |