From http://www.jwz.org/xscreensaver/xscreensaver-5.22.tar.gz
[xscreensaver] / hacks / flame.c
index 01f16ababa6c235a7e66b03c2781d0992570d9f6..18db22daec2569cea20b43586151f509c4a7a6b7 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1993-2008 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1993-2013 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -151,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;
@@ -173,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)
@@ -184,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)
            {
@@ -418,6 +419,9 @@ static const char *flame_defaults [] = {
   "*delay:     50000",
   "*delay2:    2000000",
   "*points:    10000",
+#ifdef USE_IPHONE
+  "*ignoreRotation: True",
+#endif
   0
 };
 
@@ -434,6 +438,9 @@ 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