- image->data = (char *) malloc (((xgwa.width + 1) * depth / 8)
- * 2 /* uh, I dunno... */
- );
+ image = 0;
+# ifdef HAVE_XSHM_EXTENSION
+ if (use_shm)
+ {
+ image = create_xshm_image(dpy, xgwa.visual, depth, ZPixmap, 0,
+ &shm_info, xgwa.width, 1);
+ if (!image)
+ use_shm = False;
+ }
+# endif /* HAVE_XSHM_EXTENSION */
+
+ if (!image)
+ {
+ image = XCreateImage (dpy, xgwa.visual,
+ depth, ZPixmap, 0, /* depth, format, offset */
+ 0, xgwa.width, 1, 8, 0); /* data, w, h, pad, bpl */
+ image->data = (char *) calloc(image->height, image->bytes_per_line);
+ }