X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fsubstrate.c;h=82ea6d9ee81bedf4b2dc720de28e6ae64ad134d9;hb=dba664f31aa87285db4d76cf8c5e66335299703a;hp=2ca25a99e456ba246ea3041dc5dacced000bd7dd;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/substrate.c b/hacks/substrate.c index 2ca25a99..82ea6d9e 100644 --- a/hacks/substrate.c +++ b/hacks/substrate.c @@ -198,6 +198,13 @@ static inline void start_crack(struct field *f, crack *cr) /* We timed out. Use our default values */ px = cr->x; py = cr->y; + + /* Sanity check needed */ + if (px < 0) px = 0; + if (px >= f->width) px = f->width - 1; + if (py < 0) py = 0; + if (py >= f->height) py = f->height - 1; + ref_cgrid(f, px, py) = cr->t; } @@ -311,7 +318,6 @@ static inline unsigned long rgb2point(int depth, int r, int g, int b) switch(depth) { case 32: - ret = 0xff000000; case 24: #ifdef HAVE_COCOA /* This program idiotically does not go through a color map, so @@ -487,16 +493,11 @@ movedrawcrack(struct state *st, GC fgc, struct field *f, int cracknum) cr->y += ((float) STEP * sin(cr->t * M_PI/180)); } else { - float oldx, oldy; - - oldx = cr->x; - oldy = cr->y; - cr->x += ((float) cr->ys * cos(cr->t * M_PI/180)); cr->y += ((float) cr->ys * sin(cr->t * M_PI/180)); cr->x += ((float) cr->xs * cos(cr->t * M_PI/180 - M_PI / 2)); - cr->x += ((float) cr->xs * sin(cr->t * M_PI/180 - M_PI / 2)); + cr->y += ((float) cr->xs * sin(cr->t * M_PI/180 - M_PI / 2)); cr->t += cr->t_inc; cr->degrees_drawn += abs(cr->t_inc); @@ -684,6 +685,7 @@ substrate_draw (Display *dpy, Window window, void *closure) XSetForeground(st->dpy, st->fgc, st->gcv.foreground); } + /* #### mi->recursion_depth = st->f->cycles; */ return st->growth_delay; } @@ -710,6 +712,7 @@ substrate_free (Display *dpy, Window window, void *closure) static const char *substrate_defaults[] = { ".background: white", ".foreground: black", + "*fpsSolid: true", "*wireFrame: false", "*maxCycles: 10000", "*growthDelay: 18000", @@ -717,6 +720,9 @@ static const char *substrate_defaults[] = { "*maxCracks: 100", "*sandGrains: 64", "*circlePercent: 33", +#ifdef USE_IPHONE + "*ignoreRotation: True", +#endif 0 };