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