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
/
coral.c
diff --git
a/hacks/coral.c
b/hacks/coral.c
index b69f4361c2b34afd5c6f4079082d796e61fa5b00..62df14cda924e0d08202ed9a61b4b98e269d9a7b 100644
(file)
--- a/
hacks/coral.c
+++ b/
hacks/coral.c
@@
-100,12
+100,15
@@
init_coral(struct state *st)
st->colorsloth = st->nwalkers*2/st->ncolors;
XSetForeground(st->dpy, st->draw_gc, st->colors[st->colorindex].pixel);
st->colorsloth = st->nwalkers*2/st->ncolors;
XSetForeground(st->dpy, st->draw_gc, st->colors[st->colorindex].pixel);
+ if ((st->width <= 2) || (st->height <= 2)) return;
+
for( i = 0; i < seeds; i++ ) {
int x, y;
for( i = 0; i < seeds; i++ ) {
int x, y;
+ int max_repeat = 10;
do {
x = 1 + random() % (st->width - 2);
y = 1 + random() % (st->height - 2);
do {
x = 1 + random() % (st->width - 2);
y = 1 + random() % (st->height - 2);
- } while( getdot(x, y) );
+ } while( getdot(x, y)
&& max_repeat--
);
setdot((x-1), (y-1)); setdot(x, (y-1)); setdot((x+1), (y-1));
setdot((x-1), y ); setdot(x, y ); setdot((x+1), y );
setdot((x-1), (y-1)); setdot(x, (y-1)); setdot((x+1), (y-1));
setdot((x-1), y ); setdot(x, y ); setdot((x+1), y );
@@
-169,7
+172,8
@@
coral(struct state *st)
st->nwalkers--;
st->walkers[i].x = st->walkers[st->nwalkers].x;
st->walkers[i].y = st->walkers[st->nwalkers].y;
st->nwalkers--;
st->walkers[i].x = st->walkers[st->nwalkers].x;
st->walkers[i].y = st->walkers[st->nwalkers].y;
- if( 0 == (st->nwalkers%st->colorsloth) ) {
+ if( 0 ==
+ ((st->colorsloth ? st->nwalkers%st->colorsloth : 0)) ) {
color = True;
}
color = True;
}
@@
-257,6
+261,8
@@
static void
coral_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
coral_reshape (Display *dpy, Window window, void *closure,
unsigned int w, unsigned int h)
{
+ struct state *st = (struct state *) closure;
+ init_coral(st);
}
static Bool
}
static Bool
@@
-278,6
+284,7
@@
coral_free (Display *dpy, Window window, void *closure)
static const char *coral_defaults[] = {
".background: black",
".foreground: white",
static const char *coral_defaults[] = {
".background: black",
".foreground: white",
+ "*fpsSolid: true",
"*density: 25",
"*seeds: 20", /* too many for 640x480, too few for 1280x1024 */
"*delay: 5",
"*density: 25",
"*seeds: 20", /* too many for 640x480, too few for 1280x1024 */
"*delay: 5",