On a DEC 5000 PX using the Xtm2d server, plots that contain y-axes take forever to draw. This appears to be due to a bug in either the server software or the PX hardware. Below is a context diff for a patch to X11graph.c (2.1R2 version) that works around this problem. I think it can safely be applied on any system. Apply it using `patch'. [If you care about more details, the problem is that the XGetImage call used in getting character images by the draw_char_up routine takes forever to get the image from the server when it is called while drawing a plot. Presumably this has to do with management of resources, since it is not a problem if this call occurs early in the initialization phase before all X resources have been claimed. The patch below therefore allocates all the character images it needs up front.] ------------------------------------------------------------------------------- *** X11graph.c Sun Oct 14 09:59:55 1990 --- X11graph.c.new Mon Jun 17 18:37:46 1991 *************** *** 334,339 **** --- 334,340 ---- static GC CharGC, CharEraseGC; static GC copy_gc; /* used to deal with the cfb clipping bug in R3 */ GC ResizeGC; + static XImage *cxi[128]; /* for use in reversing characters */ typedef struct { long Object; /* elements of window_data */ *************** *** 474,479 **** --- 475,481 ---- valuemask = 0; /* ignore XGCValues and use defaults */ copy_gc = XCreateGC(dpy, RootWindow(dpy, screen), valuemask, &values); + MakeCharImages(); MakeWorkPort(); MakeSymbols(); MakeGraphCursors(); *************** *** 1632,1637 **** --- 1634,1660 ---- } } + static MakeCharImages() + { + Display *dpy = StX11Display(); + int screen = StX11Screen(); + int ascent = GraphFont->max_bounds.ascent; + int width = GraphFont->max_bounds.width; + int height = GraphFont->max_bounds.ascent + GraphFont->max_bounds.descent; + int i; + char myChar; + + for (i = 0; i < 128; i++) { + if (isprint(i)) { + myChar = i; + XFillRectangle(dpy, CharPM, CharEraseGC, 0, 0, width, height); + XDrawString(dpy, CharPM, CharGC, 0, ascent, &myChar, 1); + cxi[i] = XGetImage(dpy, CharPM, 0, 0, width, height, AllPlanes, ZPixmap); + } + else cxi[i] = nil; + } + } + static draw_char_up(gwinfo, myChar, x, y) StGWWinInfo *gwinfo; char myChar; *************** *** 1649,1660 **** static XPoint *p = nil; int n; if (p == nil) p = (XPoint *) StCalloc(width * height, sizeof(XPoint)); ! if (is_allocated(gwinfo)) { ! XFillRectangle(dpy, CharPM, CharEraseGC, 0, 0, width, height); ! XDrawString(dpy, CharPM, CharGC, 0, ascent, &myChar, 1); ! xi = XGetImage(dpy, CharPM, 0, 0, width, height, AllPlanes, ZPixmap); d = get_drawable(gwinfo); for (i = 0, n = 0; i < width; i++) for (j = 0; j < height; j++) --- 1672,1684 ---- static XPoint *p = nil; int n; + if (myChar < 0) myChar = 0; + if (myChar > 127) myChar = 127; + if (p == nil) p = (XPoint *) StCalloc(width * height, sizeof(XPoint)); ! if (is_allocated(gwinfo) && cxi[myChar] != nil) { ! xi = cxi[myChar]; d = get_drawable(gwinfo); for (i = 0, n = 0; i < width; i++) for (j = 0; j < height; j++) *************** *** 1664,1670 **** n++; } XDrawPoints(dpy, d, draw_gc(gwinfo), p, n, CoordModeOrigin); - XDestroyImage(xi); } } --- 1688,1693 ----