$FreeBSD$ --- source/graph.c.orig Wed Jul 24 00:01:06 2002 +++ source/graph.c Wed Jul 24 00:01:07 2002 @@ -608,7 +608,7 @@ void getDrawingScale() { float xoff, yoff; - float scl; + float iscl; /* inverse scale */ int width, height; int ww; int nx, ny, id; @@ -630,25 +630,27 @@ width = width / nx; height = height / ny; - if(state > HAVE_NOTHING){ - scl = 1./max(xmax-xmin,ymax-ymin); - xoff = -scl*(xmin+.5*(xmax-xmin)-.5/scl); - yoff = -scl*(ymin+.5*(ymax-ymin)-.5/scl); - - xoff = - xmin*scl*.85; - yoff = - ymin*scl*.85; - - ww = min(width, height); - Xscl = (int) ((float)ww * 0.85 * scl); - Xxoff = (int) ww * xoff ; - Xyoff = (int) ww * yoff; - Xxoff += (int) (width - ( Xscl*xmax +Xxoff))/2 + (id+nx-1)%nx *width; - Xyoff += (int) (height - ( Xscl*ymax +Xyoff))/2 + (int)(id/(nx+.5)) *height; - } + iscl = max(xmax-xmin,ymax-ymin); + if (iscl != 0.0) { + if(state > HAVE_NOTHING) { +/* These are recalculated ?? + xoff = .5-(xmin+.5*(xmax-xmin))/iscl; + yoff = .5-(ymin+.5*(ymax-ymin))/iscl; +*/ + xoff = - xmin*.85/iscl; + yoff = - ymin*.85/iscl; + ww = min(width, height); + Xscl = (int) ((float)ww * 0.85 / iscl); + Xxoff = (int) ww * xoff ; + Xyoff = (int) ww * yoff; + Xxoff += (int) (width - ( Xscl*xmax +Xxoff))/2 + (id+nx-1)%nx *width; + Xyoff += (int) (height - ( Xscl*ymax +Xyoff))/2 + (int)(id/(nx+.5)) *height; + } SetDrawArea(drawWindow); if(device == PS) psGetScale(); + } } void getBoundaryScale(Widget w, void *data)