Ethereal-dev: [Ethereal-dev] [PATCH] io_stat.c: Fix for bug 714

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Bill Meier" <wmeier@xxxxxxxxxxx>
Date: Sat, 28 Jan 2006 19:26:44 -0500
Problem:  (reported as bug 714)
          IO-Stats graph 'impulse' and 'filled bar' off-scale values
          sometimes not graphed.
          (These values should aways be displayed (truncated to selected
          max y value).

Solution: Apply "line segment completely off-scale ?" test only for
          line-style charts.


The attached patch corrects the problem.

Bill Meier









Index: gtk/io_stat.c
===================================================================
--- gtk/io_stat.c	(revision 17108)
+++ gtk/io_stat.c	(working copy)
@@ -886,20 +886,16 @@
 				y_pos=draw_height-1-(val*draw_height)/max_y+top_y_border;
 			}
 
-			/* dont need to draw anything if the segment
-			 * is entirely above the top of the graph 
-			 */
-			if( (prev_y_pos==0) && (y_pos==0) ){
-				prev_y_pos=y_pos;
-				prev_x_pos=x_pos;
-				continue;
-			}
-
 			switch(io->graphs[i].plot_style){
 			case PLOT_STYLE_LINE:
-				gdk_draw_line(io->pixmap, io->graphs[i].gc, 
-					prev_x_pos, prev_y_pos, 
-					x_pos, y_pos);
+				/* dont need to draw anything if the segment
+				 * is entirely above the top of the graph 
+				 */
+				if( (prev_y_pos!=0) || (y_pos!=0) ){
+					gdk_draw_line(io->pixmap, io->graphs[i].gc, 
+						prev_x_pos, prev_y_pos, 
+						x_pos, y_pos);
+					}
 				break;
 			case PLOT_STYLE_IMPULSE:
 				if(val){