X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Ffadeplot.c;h=93f471969e409135bd5cb6788e6f544b748ac62b;hb=39809ded547bdbb08207d3e514950425215b4410;hp=9fa65f8f13f10acb2ff58f6304c194683d7c9d56;hpb=6f5482d73adb0165c0130bb47d852644ab0c4869;p=xscreensaver diff --git a/hacks/fadeplot.c b/hacks/fadeplot.c index 9fa65f8f..93f47196 100644 --- a/hacks/fadeplot.c +++ b/hacks/fadeplot.c @@ -35,9 +35,11 @@ static const char sccsid[] = "@(#)fadeplot.c 5.00 2000/11/01 xlockmore"; "*cycles: 1500 \n" \ "*ncolors: 64 \n" \ "*fpsSolid: true \n" \ + "*ignoreRotation: True \n" \ # define BRIGHT_COLORS # define UNIFORM_COLORS +# define release_fadeplot 0 # define fadeplot_handle_event 0 # include "xlockmore.h" /* in xscreensaver distribution */ #else /* STANDALONE */ @@ -51,8 +53,8 @@ ENTRYPOINT ModeSpecOpt fadeplot_opts = #ifdef USE_MODULES ModStruct fadeplot_description = -{"fadeplot", "init_fadeplot", "draw_fadeplot", "release_fadeplot", - "refresh_fadeplot", "init_fadeplot", (char *) NULL, &fadeplot_opts, +{"fadeplot", "init_fadeplot", "draw_fadeplot", (char *) NULL, + "refresh_fadeplot", "init_fadeplot", "free_fadeplot", &fadeplot_opts, 30000, 10, 1500, 1, 64, 0.6, "", "Shows a fading plot of sine squared", 0, NULL}; @@ -73,9 +75,10 @@ typedef struct { static fadeplotstruct *fadeplots = (fadeplotstruct *) NULL; -static void -free_fadeplot(fadeplotstruct *fp) +ENTRYPOINT void +free_fadeplot(ModeInfo * mi) { + fadeplotstruct *fp = &fadeplots[MI_SCREEN(mi)]; if (fp->pts != NULL) { (void) free((void *) fp->pts); fp->pts = (XPoint *) NULL; @@ -95,7 +98,7 @@ initSintab(ModeInfo * mi) fp->angles = NRAND(950) + 250; if ((fp->stab = (int *) malloc(fp->angles * sizeof (int))) == NULL) { - free_fadeplot(fp); + free_fadeplot(mi); return False; } for (i = 0; i < fp->angles; i++) { @@ -110,11 +113,7 @@ init_fadeplot (ModeInfo * mi) { fadeplotstruct *fp; - if (fadeplots == NULL) { - if ((fadeplots = (fadeplotstruct *) calloc(MI_NUM_SCREENS(mi), - sizeof (fadeplotstruct))) == NULL) - return; - } + MI_INIT (mi, fadeplots); fp = &fadeplots[MI_SCREEN(mi)]; fp->width = MI_WIDTH(mi); @@ -142,7 +141,7 @@ init_fadeplot (ModeInfo * mi) if (fp->pts == NULL) { if ((fp->pts = (XPoint *) calloc(fp->maxpts, sizeof (XPoint))) == NULL) { - free_fadeplot(fp); + free_fadeplot(mi); return; } } @@ -222,23 +221,12 @@ reshape_fadeplot(ModeInfo * mi, int width, int height) fp->factor.y = MAX(fp->height / (2 * fp->min), 1); } +#ifndef STANDALONE ENTRYPOINT void refresh_fadeplot (ModeInfo * mi) { } - -ENTRYPOINT void -release_fadeplot (ModeInfo * mi) -{ - if (fadeplots != NULL) { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) - free_fadeplot(&fadeplots[screen]); - (void) free((void *) fadeplots); - fadeplots = (fadeplotstruct *) NULL; - } -} +#endif XSCREENSAVER_MODULE ("FadePlot", fadeplot)