X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Frd-bomb.c;h=071786a0511f85b05b16b54063cb190b1b49755a;hb=6a1da724858673ac40aa13a9612340d8bed8c7b9;hp=3641282f700da31ff161edca61acde5155653987;hpb=f54438ea00f152166e68073e98000fd3a00f65cd;p=xscreensaver diff --git a/hacks/rd-bomb.c b/hacks/rd-bomb.c index 3641282f..071786a0 100644 --- a/hacks/rd-bomb.c +++ b/hacks/rd-bomb.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998, 1999 +/* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998, 1999, 2003 * Jamie Zawinski * * reaction/diffusion textures @@ -139,10 +139,10 @@ pixack_frame(char *pix_buf) if (!(frame%epoch_time)) { int s; if (0 != frame) { - int t = epoch_time / 500; - if (t > 15) - t = 15; - sleep(t); + int tt = epoch_time / 500; + if (tt > 15) + tt = 15; + sleep(tt); } for (i = 0; i < npix; i++) { @@ -379,7 +379,7 @@ screenhack (Display *dpy, Window win) double array_x, array_y; double array_dx, array_dy; int w2; - char *p; + char *pd; int vdepth; int npix; #ifdef HAVE_XSHM_EXTENSION @@ -448,6 +448,15 @@ screenhack (Display *dpy, Window win) depth 24 directly (or even better, arbitrary depths, but that would mean going through the XImage routines instead of messing with the XImage->data directly.) + + jwz, 18-Mar-99: well, the X servers I have access to these days do + support 32-deep images on deep visuals, so I no longer have the + ability to test this code -- but it was causing problems on the + visuals that I do have, and I think that's because I mistakenly + wrote `pfv[i].depth' when I meant to write `pfv[i].bits_per_pixel'. + The symptom I was seeing was that the grid was 64x64, but the + images were being drawn 32x32 -- so there was a black stripe on + every other row. Wow, this code sucks so much. */ if (pdepth == 32) { @@ -455,7 +464,7 @@ screenhack (Display *dpy, Window win) Bool ok = False; XPixmapFormatValues *pfv = XListPixmapFormats (dpy, &pfvc); for (i = 0; i < pfvc; i++) - if (pfv[i].depth == pdepth) + if (pfv[i].bits_per_pixel == pdepth) ok = True; if (!ok) pdepth = 16; @@ -488,8 +497,8 @@ screenhack (Display *dpy, Window win) } } - p = malloc(npix * (pdepth == 1 ? 1 : (pdepth / 8))); - if (!p) { + pd = malloc(npix * (pdepth == 1 ? 1 : (pdepth / 8))); + if (!pd) { fprintf(stderr, "not enough memory for %d pixels.\n", npix); exit(1); } @@ -505,8 +514,8 @@ screenhack (Display *dpy, Window win) use_shm = False; else { - free(p); - p = image->data; + free(pd); + pd = image->data; } } #endif /* HAVE_XSHM_EXTENSION */ @@ -514,7 +523,7 @@ screenhack (Display *dpy, Window win) if (!image) { image = XCreateImage(dpy, xgwa.visual, vdepth, - ZPixmap, 0, p, + ZPixmap, 0, pd, width, height, 8, 0); } @@ -522,7 +531,7 @@ screenhack (Display *dpy, Window win) Bool bump = False; int i, j; - pixack_frame(p); + pixack_frame(pd); for (i = 0; i < array_width; i += width) for (j = 0; j < array_height; j += height) #ifdef HAVE_XSHM_EXTENSION