changeset 247:dd107cd7686d

OSD/SUB support
author arpi_esp
date Thu, 29 Mar 2001 15:32:42 +0000
parents 5673f9146c54
children 33360ef1b97a
files libvo/vo_xv.c
diffstat 1 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xv.c	Thu Mar 29 14:20:01 2001 +0000
+++ b/libvo/vo_xv.c	Thu Mar 29 15:32:42 2001 +0000
@@ -253,8 +253,43 @@
   }
 }
 
+
+static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){
+    int x,y;
+
+  if (xv_format==IMGFMT_YV12){
+
+    for(y=0;y<h;y++){
+	uint8_t *dst = xvimage[0]->data + image_width * (y+y0) + x0;
+        for(x=0;x<w;x++){
+//            dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
+            if(srca[x])
+            dst[x]=(dst[x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+        }
+        src+=stride;
+        srca+=stride;
+    }
+
+  } else {
+
+    for(y=0;y<h;y++){
+	uint8_t *dst = xvimage[0]->data + 2*(image_width * (y+y0) + x0);
+        for(x=0;x<w;x++){
+//            dst[x]=(dst[x]*srca[x]+src[x]*(srca[x]^255))>>8;
+            if(srca[x])
+            dst[2*x]=(dst[2*x]*(srca[x]^255)+src[x]*(srca[x]))>>8;
+        }
+        src+=stride;
+        srca+=stride;
+    }
+
+  }
+
+}
+
 static void flip_page(void)
 {
+ vo_draw_text(image_width,image_height,draw_alpha);
  check_events();
  XvShmPutImage(mydisplay, xv_port, mywindow, mygc, xvimage[0],
          0, 0,  image_width, image_height,
@@ -264,6 +299,8 @@
  return;
 }
 
+
+
 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
 {
  uint8_t *src;