[xiph-commits] r12127 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Fri Nov 17 08:21:29 PST 2006


Author: xiphmont
Date: 2006-11-17 08:21:27 -0800 (Fri, 17 Nov 2006)
New Revision: 12127

Modified:
   trunk/sushivision/panel-2d.c
   trunk/sushivision/plot.c
   trunk/sushivision/plot.h
Log:
Add line expose compression to the plot widget; substantially frees up CPU on slow X servers 



Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c	2006-11-17 13:07:28 UTC (rev 12126)
+++ trunk/sushivision/panel-2d.c	2006-11-17 16:21:27 UTC (rev 12127)
@@ -819,7 +819,8 @@
   if(p2->last_line==h){
     p2->last_line++;
     gdk_threads_leave ();
-    update_legend(p);
+    plot_expose_request(plot);
+    update_legend(p); 
     return 0;
   }
   

Modified: trunk/sushivision/plot.c
===================================================================
--- trunk/sushivision/plot.c	2006-11-17 13:07:28 UTC (rev 12126)
+++ trunk/sushivision/plot.c	2006-11-17 16:21:27 UTC (rev 12127)
@@ -862,17 +862,34 @@
   gdk_threads_leave();
 }
 
+// 'in progress' exposes that may or may not be honored
 void plot_expose_request_line(Plot *p, int num){
   gdk_threads_enter();
   GtkWidget *widget = GTK_WIDGET(p);
   GdkRectangle r;
+  struct timeval now;
+  time_t msec;
+
+  if(num<p->expose_y_lo)
+    p->expose_y_lo=num;
+  if(num>p->expose_y_hi)
+    p->expose_y_hi=num;
+  gettimeofday(&now,NULL);
+  msec = now.tv_sec*1000 + now.tv_usec/1000;
+
+  if(msec > p->last_line_expose + 250){
+
+    r.x=0;
+    r.y=p->expose_y_lo;
+    r.width=widget->allocation.width;
+    r.height=p->expose_y_hi-p->expose_y_lo+1;
   
-  r.x=0;
-  r.y=num;
-  r.width=widget->allocation.width;
-  r.height=1;
-  
-  gdk_window_invalidate_rect (widget->window, &r, FALSE);
+    gdk_window_invalidate_rect (widget->window, &r, FALSE);
+
+    p->expose_y_lo = widget->allocation.height;
+    p->expose_y_hi=0;
+    p->last_line_expose = msec;
+  }
   gdk_threads_leave();
 }
 

Modified: trunk/sushivision/plot.h
===================================================================
--- trunk/sushivision/plot.h	2006-11-17 13:07:28 UTC (rev 12126)
+++ trunk/sushivision/plot.h	2006-11-17 16:21:27 UTC (rev 12127)
@@ -24,6 +24,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include <sys/types.h>
+#include <sys/time.h>
 #include "scale.h"
 
 G_BEGIN_DECLS
@@ -73,6 +74,10 @@
 
   int legend_entries;
   char **legend_list;
+
+  int expose_y_lo;
+  int expose_y_hi;
+  time_t last_line_expose;
 };
 
 struct _PlotClass{



More information about the commits mailing list