- 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);
+ XGetWindowAttributes (st->dpy, st->window, &st->xgwa);
+
+ st->draw_xo = (random() % st->xgwa.width) - st->xgwa.width/2;
+ st->draw_yo = (random() % st->xgwa.height) - st->xgwa.height/2;
+ st->draw_factor = (random() % st->offset) + 1;
+
+ st->depth = visual_depth(DefaultScreenOfDisplay(st->dpy), st->xgwa.visual);
+
+ st->draw_image = create_xshm_image(st->dpy, st->xgwa.visual,
+ st->depth, ZPixmap, &st->shm_info, /* depth, format, shm_info */
+ st->xgwa.width, chunk_size); /* w, h */