projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From http://www.jwz.org/xscreensaver/xscreensaver-5.18.tar.gz
[xscreensaver]
/
hacks
/
goop.c
diff --git
a/hacks/goop.c
b/hacks/goop.c
index b7670e7cf3fbcb7176b20998f52b342eeabf7e63..02a5b11352ff3f439c59d2f98f1df59066e1bfba 100644
(file)
--- a/
hacks/goop.c
+++ b/
hacks/goop.c
@@
-1,4
+1,4
@@
-/* xscreensaver, Copyright (c) 1997
, 2006
Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1997
-2008
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
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@
-47,7
+47,6
@@
#define SCALE 10000 /* fixed-point math, for sub-pixel motion */
#define DEF_COUNT 12 /* When planes and count are 0, how many blobs. */
#define SCALE 10000 /* fixed-point math, for sub-pixel motion */
#define DEF_COUNT 12 /* When planes and count are 0, how many blobs. */
-
#define RAND(n) ((long) ((random() & 0x7fffffff) % ((long) (n))))
#define RANDSIGN() ((random() & 1) ? 1 : -1)
#define RAND(n) ((long) ((random() & 0x7fffffff) % ((long) (n))))
#define RANDSIGN() ((random() & 1) ? 1 : -1)
@@
-126,7
+125,7
@@
make_blob (Display *dpy, int maxx, int maxy, int size)
b->spline = make_spline (b->npoints);
b->r = (long *) malloc (sizeof(*b->r) * b->npoints);
for (i = 0; i < b->npoints; i++)
b->spline = make_spline (b->npoints);
b->r = (long *) malloc (sizeof(*b->r) * b->npoints);
for (i = 0; i < b->npoints; i++)
- b->r[i] = ((random() % mid) + (mid/2)) * RANDSIGN();
+ b->r[i] = (
long) (
(random() % mid) + (mid/2)) * RANDSIGN();
return b;
}
return b;
}
@@
-340,7
+339,9
@@
make_goop (Screen *screen, Visual *visual, Window window, Colormap cmap,
goop->nlayers = get_integer_resource (dpy, "planes", "Planes");
if (goop->nlayers <= 0)
goop->nlayers = (random() % (depth-2)) + 2;
goop->nlayers = get_integer_resource (dpy, "planes", "Planes");
if (goop->nlayers <= 0)
goop->nlayers = (random() % (depth-2)) + 2;
- goop->layers = (struct layer **) malloc(sizeof(*goop->layers)*goop->nlayers);
+ if (! goop->layers)
+ goop->layers = (struct layer **)
+ malloc(sizeof(*goop->layers)*goop->nlayers);
goop->additive_p = get_boolean_resource (dpy, "additive", "Additive");
goop->cmap_p = has_writable_cells (screen, visual);
goop->additive_p = get_boolean_resource (dpy, "additive", "Additive");
goop->cmap_p = has_writable_cells (screen, visual);
@@
-543,7
+544,11
@@
static void
goop_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
goop_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
- /* #### write me */
+ struct goop *goop = (struct goop *) closure;
+
+ /* #### leaks like crazy */
+ struct goop *goop2 = goop_init (dpy, window);
+ memcpy (goop, goop2, sizeof(*goop));
}
static Bool
}
static Bool
@@
-566,8
+571,8
@@
static const char *goop_defaults [] = {
"*delay: 12000",
"*additive: true",
"*mode: transparent",
"*delay: 12000",
"*additive: true",
"*mode: transparent",
- "*count:
0
",
- "*planes:
0
",
+ "*count:
1
",
+ "*planes:
12
",
"*thickness: 5",
"*torque: 0.0075",
"*elasticity: 0.9",
"*thickness: 5",
"*torque: 0.0075",
"*elasticity: 0.9",