Package: libxaw7 Version: 4.2.1-3 Severity: normal Tags: patch Recently I tried to run xload on a high loaded server (load was more than 10), and discovered that if window size is rather small, scale lines are drawn incorrectly (upper than needed).
This is caused by a bug in Xaw/StripChart.c. It draws lines with fixed integer steps. Than means that if window height is 39 pixels, and 10 lines should be drawn to split view into 11 equal parts, lines will be drawn at 3, 6, 9, ,.., 30. So the bottom part height will be 9 pixels while other parts height will be 2 pixels. A patch to fix this is below. When applied, it makes part heights differ no more than by 1 pixel. Screenshots are at http://zigzag.lvk.cs.msu.su/~nikita/xload.png. The top window is xload linked against patched libXaw, the bottom window is xload linked against original libXaw. --- StripChart.c.orig Fri Dec 14 22:54:44 2001 +++ StripChart.c Sat Nov 2 17:26:15 2002 @@ -375,7 +375,7 @@ static int repaint_window(StripChartWidget w, int left, int width) { - int i, j; + int i, j, k; int next = w->strip_chart.interval; int scale = w->strip_chart.scale; int scalewidth = 0; @@ -420,8 +420,10 @@ } /* Draw graph reference lines */ + k = XtHeight(w) % w->strip_chart.scale; for (i = 1; i < w->strip_chart.scale; i++) { - j = i * ((int)XtHeight(w) / w->strip_chart.scale); + j = i * (XtHeight(w) / w->strip_chart.scale) + + ((i * k + w->strip_chart.scale/2) / w->strip_chart.scale); XDrawLine(dpy, win, w->strip_chart.hiGC, left, j, scalewidth, j); } } @@ -443,7 +445,7 @@ MoveChart(StripChartWidget w, Bool blit) { double old_max; - int left, i, j; + int left, i, j, k; int next = w->strip_chart.interval; if (!XtIsRealized((Widget)w)) @@ -492,8 +494,10 @@ /* Draw graph reference lines */ left = j; + k = XtHeight(w) % w->strip_chart.scale; for (i = 1; i < w->strip_chart.scale; i++) { - j = i * (XtHeight(w) / w->strip_chart.scale); + j = i * (XtHeight(w) / w->strip_chart.scale) + + ((i * k + w->strip_chart.scale/2) / w->strip_chart.scale); XDrawLine(XtDisplay((Widget)w), XtWindow((Widget)w), w->strip_chart.hiGC, left, j, XtWidth(w), j); } @@ -554,7 +558,7 @@ StripChartWidget w = (StripChartWidget)widget; XPoint *points; Cardinal size; - int i; + int i, k; if (w->strip_chart.scale <= 1) { XtFree((char *)w->strip_chart.points); @@ -569,8 +573,12 @@ /* Draw graph reference lines into clip mask */ + k = XtHeight(w) % w->strip_chart.scale; for (i = 1; i < w->strip_chart.scale; i++) { points[i - 1].x = 0; - points[i - 1].y = XtHeight(w) / w->strip_chart.scale; + points[i - 1].y = i * (XtHeight(w) / w->strip_chart.scale) + + ((i * k + w->strip_chart.scale/2) / w->strip_chart.scale); } + for (i = w->strip_chart.scale - 1; i > 1; i--) + points[i - 1].y -= points[i - 2].y; } -- System Information: Debian Release: 3.0 Architecture: i386 Kernel: Linux sercond 2.4.19 #1 óÂÔ óÅÎ 28 15:05:51 MSD 2002 i686 Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R Versions of packages libxaw7 depends on: ii libc6 2.3.1-3 GNU C Library: Shared libraries an ii xlibs 4.2.1-3 X Window System client libraries -- no debconf information