changeset 5642:eb0cb6185e6c

osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
author arpi
date Mon, 15 Apr 2002 22:08:50 +0000
parents 85df37cde3d3
children 3d9de27d9bd0
files libvo/sub.c libvo/sub.h
diffstat 2 files changed, 27 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/sub.c	Mon Apr 15 20:54:28 2002 +0000
+++ b/libvo/sub.c	Mon Apr 15 22:08:50 2002 +0000
@@ -427,13 +427,31 @@
     new_osd_obj(OSDTYPE_VOBSUB);
 }
 
+int vo_osd_changed_flag=0;
+
+void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)){
+    mp_osd_obj_t* obj=vo_osd_list;
+    vo_update_osd(dxs,dys);
+    while(obj){
+      if(((obj->flags&OSDFLAG_CHANGED) || (obj->flags&OSDFLAG_VISIBLE)) && 
+         (obj->flags&OSDFLAG_OLD_BBOX)){
+          int w=obj->old_bbox.x2-obj->old_bbox.x1;
+	  int h=obj->old_bbox.y2-obj->old_bbox.y1;
+	  if(w>0 && h>0){
+	      vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED;	// temp hack
+              remove(obj->old_bbox.x1,obj->old_bbox.y1,w,h);
+	  }
+//	  obj->flags&=~OSDFLAG_OLD_BBOX;
+      }
+    }
+}
+
 void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
     mp_osd_obj_t* obj=vo_osd_list;
-
     vo_update_osd(dxs,dys);
-
     while(obj){
-	if(obj->flags&OSDFLAG_VISIBLE)
+      if(obj->flags&OSDFLAG_VISIBLE){
+	vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED;	// temp hack
 	switch(obj->type){
 	case OSDTYPE_SPU:
 	    spudec_draw_scaled(vo_spudec, dxs, dys, draw_alpha); // FIXME
@@ -452,9 +470,10 @@
 	    break;
 	}
 	obj->old_bbox=obj->bbox;
-	obj->flags&=~OSDFLAG_CHANGED;
-
-	obj=obj->next;
+	obj->flags|=OSDFLAG_OLD_BBOX;
+      }
+      obj->flags&=~OSDFLAG_CHANGED;
+      obj=obj->next;
     }
 }
 
--- a/libvo/sub.h	Mon Apr 15 20:54:28 2002 +0000
+++ b/libvo/sub.h	Mon Apr 15 22:08:50 2002 +0000
@@ -94,5 +94,7 @@
 int vo_update_osd(int dxs,int dys);
 int vo_osd_changed(int new_value);
 
+extern int vo_osd_changed_flag;
+
 #endif
 #endif