X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fthornbird.c;h=2ebbf17297db01dcda1ee404c6c6cb4e4af0e437;hb=4361b69d3178d7fc98d0388f9a223af6c2651aba;hp=28a98db2404b475fa6be33ad4459d833d104bbef;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/hacks/thornbird.c b/hacks/thornbird.c index 28a98db2..2ebbf172 100644 --- a/hacks/thornbird.c +++ b/hacks/thornbird.c @@ -34,9 +34,12 @@ static const char sccsid[] = "@(#)thornbird.c 5.00 2000/11/01 xlockmore"; #define DEFAULTS "*delay: 10000 \n" \ "*count: 100 \n" \ "*cycles: 400 \n" \ - "*ncolors: 64 \n" + "*ncolors: 64 \n" \ + "*fpsSolid: true \n" \ + "*ignoreRotation: True \n" \ + # define BRIGHT_COLORS -# define reshape_thornbird 0 +# define release_thornbird 0 # define thornbird_handle_event 0 # include "xlockmore.h" /* in xscreensaver distribution */ #else /* STANDALONE */ @@ -50,7 +53,7 @@ ENTRYPOINT ModeSpecOpt thornbird_opts = #ifdef USE_MODULES ModStruct thornbird_description = -{"thornbird", "init_thornbird", "draw_thornbird", "release_thornbird", +{"thornbird", "init_thornbird", "draw_thornbird", (char *) NULL, "refresh_thornbird", "init_thornbird", (char *) NULL, þbird_opts, 1000, 800, 16, 1, 64, 1.0, "", "Shows an animated Bird in a Thorn Bush fractal map", 0, NULL}; @@ -89,8 +92,9 @@ typedef struct { static thornbirdstruct *thornbirds = (thornbirdstruct *) NULL; static void -free_thornbird(thornbirdstruct *hp) +free_thornbird(ModeInfo * mi) { + thornbirdstruct *hp = þbirds[MI_SCREEN(mi)]; if (hp->pointBuffer != NULL) { int buffer; @@ -107,12 +111,7 @@ init_thornbird (ModeInfo * mi) { thornbirdstruct *hp; - if (thornbirds == NULL) { - if ((thornbirds = - (thornbirdstruct *) calloc(MI_NUM_SCREENS(mi), - sizeof (thornbirdstruct))) == NULL) - return; - } + MI_INIT (mi, thornbirds, free_thornbird); hp = þbirds[MI_SCREEN(mi)]; @@ -130,14 +129,14 @@ init_thornbird (ModeInfo * mi) if (hp->pointBuffer == NULL) if ((hp->pointBuffer = (XPoint **) calloc(MI_CYCLES(mi), sizeof (XPoint *))) == NULL) { - free_thornbird(hp); + free_thornbird(mi); return; } if (hp->pointBuffer[0] == NULL) if ((hp->pointBuffer[0] = (XPoint *) malloc(MI_COUNT(mi) * sizeof (XPoint))) == NULL) { - free_thornbird(hp); + free_thornbird(mi); return; } @@ -220,10 +219,11 @@ draw_thornbird(ModeInfo * mi) MI_IS_DRAWN(mi) = True; + if (MI_COUNT(mi) < 1) MI_COUNT(mi) = 1; if (hp->pointBuffer[erase] == NULL) { if ((hp->pointBuffer[erase] = (XPoint *) malloc(MI_COUNT(mi) * sizeof (XPoint))) == NULL) { - free_thornbird(hp); + free_thornbird(mi); return; } } else { @@ -246,20 +246,13 @@ draw_thornbird(ModeInfo * mi) XDrawPoints(dsp, win, gc, hp->pointBuffer[current], batchcount, CoordModeOrigin); hp->inc++; - } ENTRYPOINT void -release_thornbird(ModeInfo * mi) +reshape_thornbird(ModeInfo * mi, int width, int height) { - if (thornbirds != NULL) { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) - free_thornbird(þbirds[screen]); - (void) free((void *) thornbirds); - thornbirds = (thornbirdstruct *) NULL; - } + XClearWindow (MI_DISPLAY (mi), MI_WINDOW(mi)); + init_thornbird (mi); } ENTRYPOINT void