"*cycles: 1500 \n" \
"*ncolors: 64 \n" \
"*fpsSolid: true \n" \
+ "*ignoreRotation: True \n" \
# define BRIGHT_COLORS
# define UNIFORM_COLORS
-# define reshape_fadeplot 0
+# define release_fadeplot 0
# define fadeplot_handle_event 0
# include "xlockmore.h" /* in xscreensaver distribution */
#else /* STANDALONE */
#ifdef USE_MODULES
ModStruct fadeplot_description =
-{"fadeplot", "init_fadeplot", "draw_fadeplot", "release_fadeplot",
+{"fadeplot", "init_fadeplot", "draw_fadeplot", (char *) NULL,
"refresh_fadeplot", "init_fadeplot", (char *) NULL, &fadeplot_opts,
30000, 10, 1500, 1, 64, 0.6, "",
"Shows a fading plot of sine squared", 0, NULL};
static fadeplotstruct *fadeplots = (fadeplotstruct *) NULL;
static void
-free_fadeplot(fadeplotstruct *fp)
+free_fadeplot(ModeInfo * mi)
{
+ fadeplotstruct *fp = &fadeplots[MI_SCREEN(mi)];
if (fp->pts != NULL) {
(void) free((void *) fp->pts);
fp->pts = (XPoint *) NULL;
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++) {
{
fadeplotstruct *fp;
- if (fadeplots == NULL) {
- if ((fadeplots = (fadeplotstruct *) calloc(MI_NUM_SCREENS(mi),
- sizeof (fadeplotstruct))) == NULL)
- return;
- }
+ MI_INIT (mi, fadeplots, free_fadeplot);
fp = &fadeplots[MI_SCREEN(mi)];
fp->width = MI_WIDTH(mi);
if (fp->pts == NULL) {
if ((fp->pts = (XPoint *) calloc(fp->maxpts, sizeof (XPoint))) ==
NULL) {
- free_fadeplot(fp);
+ free_fadeplot(mi);
return;
}
}
if ((fp->temps % (fp->angles / 2)) == 0) {
fp->temps = fp->temps % fp->angles * 5;
if ((fp->temps % (fp->angles)) == 0)
- fp->speed.y = (fp->speed.y++) % 30 + 1;
+ fp->speed.y = (fp->speed.y + 1) % 30 + 1;
if ((fp->temps % (fp->angles * 2)) == 0)
fp->speed.x = (fp->speed.x) % 20;
if ((fp->temps % (fp->angles * 3)) == 0)
- fp->step.y = (fp->step.y++) % 2 + 1;
+ fp->step.y = (fp->step.y + 1) % 2 + 1;
MI_CLEARWINDOW(mi);
}
}
ENTRYPOINT void
-refresh_fadeplot (ModeInfo * mi)
+reshape_fadeplot(ModeInfo * mi, int width, int height)
{
- MI_CLEARWINDOW(mi);
+ fadeplotstruct *fp = &fadeplots[MI_SCREEN(mi)];
+ fp->width = width;
+ fp->height = height;
+ fp->min = MAX(MIN(fp->width, fp->height) / 2, 1);
+ fp->factor.x = MAX(fp->width / (2 * fp->min), 1);
+ fp->factor.y = MAX(fp->height / (2 * fp->min), 1);
}
ENTRYPOINT void
-release_fadeplot (ModeInfo * mi)
+refresh_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;
- }
}
XSCREENSAVER_MODULE ("FadePlot", fadeplot)