X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fripples.c;h=bffd2c68014f79a0de17d903f40c9cc909388ff2;hb=3f1091236d800c43a3124c44c7da54e53f205b13;hp=fac61995060e103740a8c5212a1ce64237189925;hpb=c1b9b55ad8d59dc05ef55e316aebf5863e7dfa56;p=xscreensaver diff --git a/hacks/ripples.c b/hacks/ripples.c index fac61995..bffd2c68 100644 --- a/hacks/ripples.c +++ b/hacks/ripples.c @@ -62,6 +62,7 @@ struct state { XImage *orig_map, *buffer_map; int ctab[256]; Colormap colormap; + Screen *screen; int ncolors; int light; @@ -495,6 +496,7 @@ setup_X(struct state *st) XGetWindowAttributes(st->dpy, st->window, &xgwa); depth = xgwa.depth; st->colormap = xgwa.colormap; + st->screen = xgwa.screen; st->bigwidth = xgwa.width; st->bigheight = xgwa.height; st->visual = xgwa.visual; @@ -656,7 +658,8 @@ init_oily_colors(struct state *st) if (!mono_p) { colors = (XColor *)malloc(sizeof(*colors) * (st->ncolors+1)); - make_smooth_colormap(st->dpy, st->visual, st->colormap, colors, &st->ncolors, + make_smooth_colormap(st->screen, st->visual, st->colormap, + colors, &st->ncolors, True, /* allocate */ False, /* not writable */ True); /* verbose (complain about failure) */ @@ -703,6 +706,7 @@ sinc(struct state *st, double x) int i; i = (int)(x * TABLE + 0.5); if (i >= TABLE) i = (TABLE-1) - (i-(TABLE-1)); + if (i < 0) return 0.; return st->cos_tab[i]; #elif 0 return cos(x * M_PI/2); @@ -732,7 +736,7 @@ add_circle_drop(struct state *st, int x, int y, int radius, int dheight) r = cx*cx + cy*cy; if (r > r2) break; buf[xx + yy*st->width] = - (short)(dheight * sinc(st, sqrt(r)/radius)); + (short)(dheight * sinc(st, (radius > 0) ? sqrt(r)/radius : 0)); } } @@ -1103,6 +1107,9 @@ static const char *ripples_defaults[] = "*useSHM: True", #else "*useSHM: False", +#endif +#ifdef USE_IPHONE + "*ignoreRotation: True", #endif 0 };