X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Frd-bomb.c;h=4833c370d83d53fbe586080461bf787e8f8aae03;hb=d6b0217f2417bd19187f0ebc389d6c5c2233b11c;hp=0c074ea49f442e928539ab323da3f939e9af6383;hpb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56;p=xscreensaver diff --git a/hacks/rd-bomb.c b/hacks/rd-bomb.c index 0c074ea4..4833c370 100644 --- a/hacks/rd-bomb.c +++ b/hacks/rd-bomb.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1992-2008 Jamie Zawinski +/* xscreensaver, Copyright (c) 1992-2014 Jamie Zawinski * * reaction/diffusion textures * Copyright (c) 1997 Scott Draves spot@transmeta.com @@ -95,10 +95,13 @@ pixack_init(struct state *st, int *size_h, int *size_v) st->height = get_integer_resource (st->dpy, "height", "Integer"); if (st->width <= 0 && st->height <= 0 && (R & 1)) - st->width = st->height = 48 + BELLRAND(256); + st->width = st->height = 64 + BELLRAND(512); - if (st->width <= 0) st->width = 48 + BELLRAND(256); - if (st->height <= 0) st->height = 48 + BELLRAND(256); + if (st->width <= 0) st->width = 64 + BELLRAND(512); + if (st->height <= 0) st->height = 64 + BELLRAND(512); + + if (st->width > st->xgwa.width) st->width = st->xgwa.width; + if (st->height > st->xgwa.height) st->height = st->xgwa.height; /* 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 @@ -142,12 +145,6 @@ pixack_frame(struct state *st, char *pix_buf) if (!(st->frame%st->epoch_time)) { int s; - if (0 != st->frame) { - int tt = st->epoch_time / 500; - if (tt > 15) - tt = 15; - /*sleep(tt);*/ - } for (i = 0; i < st->npix; i++) { /* equilibrium */ @@ -233,7 +230,9 @@ pixack_frame(struct state *st, char *pix_buf) /* John E. Pearson "Complex Patterns in a Simple System" Science, July 1993 */ - uvv = (((r1 * r2) >> bps) * r2) >> bps; + /* uvv = (((r1 * r2) >> bps) * r2) >> bps; */ + /* avoid signed integer overflow */ + uvv = ((((r1 >> 1)* r2) >> bps) * r2) >> (bps - 1); switch (st->reaction) { /* costs 4% */ case 0: r1 += 4 * (((28 * (mx-r1)) >> 10) - uvv); @@ -308,6 +307,9 @@ static const char *rd_defaults [] = { "*useSHM: True", #else "*useSHM: False", +#endif +#ifdef HAVE_MOBILE + "*ignoreRotation: True", #endif 0 }; @@ -333,7 +335,8 @@ static void random_colors(struct state *st) { memset(st->colors, 0, st->ncolors*sizeof(*st->colors)); - make_smooth_colormap (st->dpy, st->visual, st->cmap, st->colors, &st->ncolors, + make_smooth_colormap (st->xgwa.screen, st->visual, st->cmap, + st->colors, &st->ncolors, True, 0, True); if (st->ncolors <= 2) { mono_p = True; @@ -369,7 +372,6 @@ rd_init (Display *dpy, Window win) { struct state *st = (struct state *) calloc (1, sizeof(*st)); XGCValues gcv; - int w2; int vdepth; st->dpy = dpy; @@ -409,7 +411,6 @@ rd_init (Display *dpy, Window win) } st->npix = (st->width + 2) * (st->height + 2); - w2 = st->width + 2; /* gcv.function = GXcopy;*/ st->gc = XCreateGC(st->dpy, win, 0 /*GCFunction*/, &gcv); vdepth = visual_depth(DefaultScreenOfDisplay(st->dpy), st->xgwa.visual);