- c->row[i] = c->pal[result].pixel;
-#else
- XFillRectangle(c->dpy, TARGET(c), c->gcs[result], g*i, g*j, g, g);
-#endif /* USE_XIMAGE */
- }
-
-#ifdef USE_XIMAGE
- /* Fill in these `gridsize' horizontal bits in the scanline */
- if(c->ximage->bits_per_pixel == 32)
- {
- uint32_t *ptr = (uint32_t *)scanline;
- for(i = 0; i < w_div_g; i++) {
- for(k = 0; k < g; k++)
- ptr[g*i+k] = c->row[i];
- }
- }
- else if(c->ximage->bits_per_pixel == 24)
- {
- uint8_t *ptr = (uint8_t *)scanline;
- for(i = 0; i < w_div_g; i++) {
- for(k = 0; k < g; k++) {
- uint32_t pixel = c->row[i];
- /* Might not work on big-endian. */
- ptr[0] = pixel;
- ptr[1] = (pixel & 0x0000ff00) >> 8;
- ptr[2] = (pixel & 0x00ff0000) >> 16;
- ptr += 3;
- }
- }
- }
- else if(c->ximage->bits_per_pixel == 16)
- {
- uint16_t *ptr = (uint16_t *)scanline;
- for(i = 0; i < w_div_g; i++) {
- for(k = 0; k < g; k++)
- ptr[g*i+k] = c->row[i];
- }
- }
- else if(c->ximage->bits_per_pixel == 8)
- {
- uint8_t *ptr = (uint8_t *)scanline;
- for(i = 0; i < w_div_g; i++) {
- for(k = 0; k < g; k++)
- ptr[g*i+k] = c->row[i];
- }
- }
- else
- {
- for(i = 0; i < w_div_g; i++) {
- for(k = 0; k < g; k++)
- XPutPixel(c->ximage, (g*i)+k, img_y, c->row[i]);
- }
- }
-
- /* Only the first scanline of the image has been filled in; clone that
- scanline to the rest of the `gridsize' lines in the ximage */
- for(k = 0; k < (g-1); k++)
- memcpy(c->ximage->data + (c->ximage->bytes_per_line * (img_y + k + 1)),
- c->ximage->data + (c->ximage->bytes_per_line * img_y),
- c->ximage->bytes_per_line);
-
-# ifndef USE_BIG_XIMAGE
- /* Move the bits for this horizontal stripe to the server. */
-# ifdef HAVE_XSHM_EXTENSION
- if (!c->use_shm)
-# endif /* HAVE_XSHM_EXTENSION */
- XPutImage(c->dpy, TARGET(c), c->copy_gc, c->ximage,
- 0, 0, 0, g*j, c->ximage->width, c->ximage->height);
-# endif
-
-# if defined HAVE_XSHM_EXTENSION && !defined USE_BIG_XIMAGE
- if (c->use_shm)
-# endif
- {
-# if defined HAVE_XSHM_EXTENSION || defined USE_BIG_XIMAGE
- scanline = (char *)scanline + c->ximage->bytes_per_line * g;
- img_y += g;
-# endif
- }
-
-#endif /* USE_XIMAGE */
- }
-
-#ifdef HAVE_XSHM_EXTENSION
- if (c->use_shm)
- {
- XShmPutImage(c->dpy, c->win, c->copy_gc, c->ximage,
- 0, 0, 0, 0, c->ximage->width, c->ximage->height,
- True);
- c->shm_can_draw = False;
- }
-#endif
-#if defined HAVE_XSHM_EXTENSION && defined USE_BIG_XIMAGE
- else
-#endif
-#ifdef USE_BIG_XIMAGE
- {
- XPutImage(c->dpy, TARGET(c), c->copy_gc, c->ximage,
- 0, 0, 0, 0, c->ximage->width, c->ximage->height);
- }