--- mplayer/libvo/vo_ggi.c 2006-06-30 00:42:31.000000000 -0600 +++ mplayer-patched/libvo/vo_ggi.c 2006-06-30 00:41:31.000000000 -0600 @@ -70,6 +70,10 @@ } ggi_conf; +static void (*draw_alpha_p)(int w, int h, unsigned char *src, + unsigned char *srca, int stride, unsigned char *dst, + int dstride); + #ifdef HAVE_GGIWMH static void window_ontop(void) { @@ -171,7 +175,8 @@ if (GT_SCHEME(mode.graphtype) == GT_PALETTE) ggiSetColorfulPalette(ggi_conf.vis); - if (GT_SCHEME(mode.graphtype) != GT_TRUECOLOR) { + if (GT_SCHEME(mode.graphtype) != GT_TRUECOLOR) + { ggi_mode drawmode; ggi_conf.drawvis = ggiOpen("display-memory", NULL); @@ -202,7 +207,6 @@ vo_dheight = height; vo_dbpp = GT_SIZE(mode.graphtype); - /* calculate top, left corner */ vo_dx = (vo_screenwidth - vo_dwidth) / 2; vo_dy = (vo_screenheight - vo_dheight) / 2; @@ -230,6 +234,7 @@ ggi_conf.srcbpp = (ggi_conf.srcdepth + 7) / 8; + ggi_conf.flushregion.x1 = vo_dx; ggi_conf.flushregion.y1 = vo_dy; ggi_conf.flushregion.x2 = vo_dwidth; @@ -267,7 +272,8 @@ mpi->flags |= MP_IMGFLAG_DIRECT; #ifdef GGI_FLIP - if (ggi_conf.voflags & VOFLAG_FLIPPING) { + if (ggi_conf.voflags & VOFLAG_FLIPPING) + { mpi->stride[0] = -mpi->stride[0]; } #endif @@ -276,27 +282,43 @@ } -static int draw_frame(uint8_t *src[]) -{ - ggiPutBox(ggi_conf.drawvis, vo_dx, vo_dy, - vo_dwidth, vo_dheight, src[0]); +static int draw_frame(uint8_t *src[]) { return 1; } - ggi_conf.flushregion.x1 = vo_dx; - ggi_conf.flushregion.y1 = vo_dy; - ggi_conf.flushregion.x2 = vo_dwidth; - ggi_conf.flushregion.y2 = vo_dheight; +/* here we store osd region offsets and data globally so in draw_stride + the alpha can be calculated and drawn correctly, this safes page flip */ - return (0); +static struct { + int x, y, w, h, stride; + unsigned char *src, *srca; +} osd_stack[5]; + +static int osd_stack_off; + +static void draw_alpha(int x, int y, int w, int h, unsigned char *src, + unsigned char *srca, int stride) +{ + if(osd_stack_off < sizeof(osd_stack)/sizeof(osd_stack[0])) + { + osd_stack[osd_stack_off].x = x; + osd_stack[osd_stack_off].y = y; + osd_stack[osd_stack_off].w = w; + osd_stack[osd_stack_off].h = h; + osd_stack[osd_stack_off].stride = stride; + osd_stack[osd_stack_off].src = src; + osd_stack[osd_stack_off].srca = srca; + osd_stack_off++; + } } static void draw_osd(void) { - return; + vo_draw_text(ggi_conf.srcwidth, ggi_conf.srcheight, draw_alpha); } static void flip_page(void) { - if (ggi_conf.drawvis != ggi_conf.vis) { + if (ggi_conf.drawvis != ggi_conf.vis) + { #if 0 ggiFlushRegion(ggi_conf.drawvis, ggi_conf.flushregion.x1, ggi_conf.flushregion.y1, @@ -323,6 +345,19 @@ static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) { + while(osd_stack_off > 0) { + osd_stack_off--; + char *dst = src[0] + (osd_stack[osd_stack_off].x + + osd_stack[osd_stack_off].y * w) + * ggi_conf.srcbpp; + draw_alpha_p(osd_stack[osd_stack_off].w, + osd_stack[osd_stack_off].h, + osd_stack[osd_stack_off].src, + osd_stack[osd_stack_off].srca, + osd_stack[osd_stack_off].stride, + dst, w*ggi_conf.srcbpp); + } + ggiPutBox(ggi_conf.drawvis, vo_dx + x, vo_dy + y, w, h, src[0]); if ((ggi_conf.flushregion.x1 == -1) || @@ -454,6 +489,25 @@ static int control(uint32_t request, void *data, ...) { + + switch (vo_dbpp) { + case 32: + draw_alpha_p = vo_draw_alpha_rgb32; + break; + case 24: + draw_alpha_p = vo_draw_alpha_rgb24; + break; + case 16: + draw_alpha_p = vo_draw_alpha_rgb16; + break; + case 15: + draw_alpha_p = vo_draw_alpha_rgb15; + break; + default: + mp_msg(MSGT_VO, MSGL_FATAL, "[ggi] Unknown bit depth: %d\n", vo_dbpp); + + } + switch (request) { case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t *) data)); @@ -466,6 +520,7 @@ return VO_TRUE; #endif } + return VO_NOTIMPL; }