X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Frd-bomb.c;h=6fb0afb7e0734c08f93b512a84e8fa40d7e45db2;hp=c4b56391d2044ab9edd07a7953e67d06ab21be9e;hb=488f2fa8fbdbc77e91a70da2962d73af49e6cace;hpb=c8c6deae79b408cffbc88043c766b3bc12cf0f13 diff --git a/hacks/rd-bomb.c b/hacks/rd-bomb.c index c4b56391..6fb0afb7 100644 --- a/hacks/rd-bomb.c +++ b/hacks/rd-bomb.c @@ -87,22 +87,26 @@ static void random_colors(struct state *st); /* why strip bit? */ #define R (random()&((1<<30)-1)) +#define BELLRAND(x) (((random()%(x)) + (random()%(x)) + (random()%(x)))/3) /* returns number of pixels that the pixack produces. called once. */ static void pixack_init(struct state *st, int *size_h, int *size_v) { - int sz_base; - st->width = get_integer_resource (st->dpy, "width", "Integer"); + st->width = get_integer_resource (st->dpy, "width", "Integer"); st->height = get_integer_resource (st->dpy, "height", "Integer"); - sz_base = 80 + (R%40); - if (st->width <= 0) st->width = (R%20) ? sz_base : (28 + R%10); - if (st->height <= 0) st->height = (R%20) ? sz_base : (28 + R%10); + + if (st->width <= 0 && st->height <= 0 && (R & 1)) + st->width = st->height = 48 + BELLRAND(256); + + if (st->width <= 0) st->width = 48 + BELLRAND(256); + if (st->height <= 0) st->height = 48 + BELLRAND(256); /* jwz: when (and only when) XSHM is in use on an SGI 8-bit visual, we get shear unless st->width is a multiple of 4. I don't understand why. This is undoubtedly the wrong fix... */ - st->width &= ~0x7; + if (visual_depth (st->xgwa.screen, st->xgwa.visual) == 8) + st->width &= ~0x7; /* don't go there */ if (st->width < 10) st->width = 10;