X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fflame.c;h=9f13c87bafe93beac020afcec0876306688d88bc;hb=d5186197bc394e10a4402f7f6d23fbb14103bc50;hp=fcc488e51c8f25e7c79e3c5411079ff597f62c7c;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/flame.c b/hacks/flame.c index fcc488e5..9f13c87b 100644 --- a/hacks/flame.c +++ b/hacks/flame.c @@ -1,5 +1,4 @@ -/* xscreensaver, Copyright (c) 1993, 1995, 1996, 1998 - * Jamie Zawinski +/* xscreensaver, Copyright (c) 1993-2014 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -152,7 +151,8 @@ flame_init (Display *dpy, Window window) st->ncolors = get_integer_resource (st->dpy, "colors", "Integer"); if (st->ncolors <= 0) st->ncolors = 128; st->colors = (XColor *) malloc ((st->ncolors+1) * sizeof (*st->colors)); - make_smooth_colormap (st->dpy, xgwa.visual, xgwa.colormap, st->colors, &st->ncolors, + make_smooth_colormap (xgwa.screen, xgwa.visual, xgwa.colormap, + st->colors, &st->ncolors, True, 0, True); if (st->ncolors <= 2) mono_p = True, st->ncolors = 0; @@ -174,7 +174,7 @@ flame_init (Display *dpy, Window window) static int recurse (struct state *st, double x, double y, int l, Display *dpy, Window win) { - int xp, yp, i; + int i; double nx, ny; if (l == st->max_levels) @@ -185,8 +185,8 @@ recurse (struct state *st, double x, double y, int l, Display *dpy, Window win) if (x > -1.0 && x < 1.0 && y > -1.0 && y < 1.0) { - xp = st->points[st->num_points].x = (int) ((st->width / 2) * (x + 1.0)); - yp = st->points[st->num_points].y = (int) ((st->height / 2) * (y + 1.0)); + st->points[st->num_points].x = (int) ((st->width / 2) * (x + 1.0)); + st->points[st->num_points].y = (int) ((st->height / 2) * (y + 1.0)); st->num_points++; if (st->num_points >= POINT_BUFFER_SIZE) { @@ -204,7 +204,7 @@ recurse (struct state *st, double x, double y, int l, Display *dpy, Window win) "I think this happens on HPUX. I think it's non-IEEE to generate an exception instead of a silent NaN." */ - if ((abs(x) > 1.0E5) || (abs(y) > 1.0E5)) + if ((fabs(x) > 1.0E5) || (fabs(y) > 1.0E5)) x = x / y; nx = st->f[0][0][i] * x + st->f[0][1][i] * y + st->f[0][2][i]; @@ -413,11 +413,15 @@ int matherr(x) static const char *flame_defaults [] = { ".background: black", ".foreground: white", + "*fpsSolid: true", "*colors: 64", "*iterations: 25", "*delay: 50000", "*delay2: 2000000", "*points: 10000", +#ifdef USE_IPHONE + "*ignoreRotation: True", +#endif 0 }; @@ -434,11 +438,20 @@ static void flame_reshape (Display *dpy, Window window, void *closure, unsigned int w, unsigned int h) { + struct state *st = (struct state *) closure; + st->width = w; + st->height = h; } static Bool flame_event (Display *dpy, Window window, void *closure, XEvent *event) { + struct state *st = (struct state *) closure; + if (screenhack_event_helper (dpy, window, event)) + { + st->do_reset = 1; + return True; + } return False; }