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.38.tar.gz
[xscreensaver]
/
hacks
/
lisa.c
diff --git
a/hacks/lisa.c
b/hacks/lisa.c
index 1972389c866ab09a1b2c10f072ff8bda0a6f0983..d0303b80c20a3a2a1c7359df3b3791ce908aa346 100644
(file)
--- a/
hacks/lisa.c
+++ b/
hacks/lisa.c
@@
-1,5
+1,5
@@
/* -*- Mode: C; tab-width: 4 -*- */
/* -*- Mode: C; tab-width: 4 -*- */
-/* lisa --- animated full-loop lisajous figures */
+/* lisa --- animated full-loop lis
s
ajous figures */
#if 0
static const char sccsid[] = "@(#)lisa.c 5.00 2000/11/01 xlockmore";
#if 0
static const char sccsid[] = "@(#)lisa.c 5.00 2000/11/01 xlockmore";
@@
-27,7
+27,7
@@
static const char sccsid[] = "@(#)lisa.c 5.00 2000/11/01 xlockmore";
*
* The inspiration for this program, Lasp, was written by Adam B. Roach
* in 1990, assisted by me, Caleb Cullen. It was written first in C, then
*
* The inspiration for this program, Lasp, was written by Adam B. Roach
* in 1990, assisted by me, Caleb Cullen. It was written first in C, then
- * in assembly, and used pre-calculated data tables to graph lisajous
+ * in assembly, and used pre-calculated data tables to graph lis
s
ajous
* figures on 386 machines and lower. This version bears only superficial
* resemblances to the original Lasp.
*
* figures on 386 machines and lower. This version bears only superficial
* resemblances to the original Lasp.
*
@@
-55,11
+55,15
@@
static const char sccsid[] = "@(#)lisa.c 5.00 2000/11/01 xlockmore";
# define DEFAULTS "*delay: 17000 \n" \
"*count: 1 \n" \
"*cycles: 768 \n" \
# define DEFAULTS "*delay: 17000 \n" \
"*count: 1 \n" \
"*cycles: 768 \n" \
- "*size: -1 \n" \
- "*ncolors: 64 \n"
+ "*size: 500 \n" \
+ "*ncolors: 64 \n" \
+ "*fpsSolid: true \n" \
+ "*lowrez: True \n" \
+
# define UNIFORM_COLORS
# define UNIFORM_COLORS
+# define release_lisa 0
# define reshape_lisa 0
# define reshape_lisa 0
-# define lisa_handle_event
0
+# define lisa_handle_event
xlockmore_no_events
# include "xlockmore.h" /* in xscreensaver distribution */
#else /* STANDALONE */
#include "xlock.h" /* in xlockmore distribution */
# include "xlockmore.h" /* in xscreensaver distribution */
#else /* STANDALONE */
#include "xlock.h" /* in xlockmore distribution */
@@
-93,10
+97,10
@@
ENTRYPOINT ModeSpecOpt lisa_opts =
#ifdef USE_MODULES
ModStruct lisa_description =
#ifdef USE_MODULES
ModStruct lisa_description =
-{"lisa", "init_lisa", "draw_lisa",
"release_lisa"
,
- "refresh_lisa", "change_lisa",
(char *) NULL
, &lisa_opts,
+{"lisa", "init_lisa", "draw_lisa",
(char *) NULL
,
+ "refresh_lisa", "change_lisa",
"free_lisa"
, &lisa_opts,
17000, 1, 768, -1, 64, 1.0, "",
17000, 1, 768, -1, 64, 1.0, "",
- "Shows animated lisajous figures", 0, NULL};
+ "Shows animated lis
s
ajous figures", 0, NULL};
#endif
#endif
@@
-156,8
+160,8
@@
typedef struct lisa_struct {
} lisas;
typedef struct lisacontext_struct {
} lisas;
typedef struct lisacontext_struct {
- lisas *lisajous;
- int width, height, nlisajous, loopcount;
+ lisas *lis
s
ajous;
+ int width, height, nlis
s
ajous, loopcount;
int maxcycles;
Bool painted;
} lisacons;
int maxcycles;
Bool painted;
} lisacons;
@@
-254,17
+258,18
@@
static lisafuncs Function[NUMSTDFUNCS] =
int xMaxLines;
int xMaxLines;
-
static
void
-free_lisa(
lisacons *lc
)
+
ENTRYPOINT
void
+free_lisa(
ModeInfo * mi
)
{
{
- while (lc->lisajous) {
+ lisacons *lc = &Lisa[MI_SCREEN(mi)];
+ while (lc->lissajous) {
int lctr;
int lctr;
- for (lctr = 0; lctr < lc->nlisajous; lctr++) {
- (void) free((void *) lc->lisajous[lctr].lastpoint);
+ for (lctr = 0; lctr < lc->nlis
s
ajous; lctr++) {
+ (void) free((void *) lc->lis
s
ajous[lctr].lastpoint);
}
}
- (void) free((void *) lc->lisajous);
- lc->lisajous = (lisas *) NULL;
+ (void) free((void *) lc->lis
s
ajous);
+ lc->lis
s
ajous = (lisas *) NULL;
}
}
}
}
@@
-284,7
+289,7
@@
drawlisa(ModeInfo * mi, lisas * loop)
/* Allocate the np (new point) array (with padding) */
if ((np = (XPoint *) calloc(loop->nsteps+extra_points, sizeof (XPoint))) == NULL) {
/* Allocate the np (new point) array (with padding) */
if ((np = (XPoint *) calloc(loop->nsteps+extra_points, sizeof (XPoint))) == NULL) {
- free_lisa(
lc
);
+ free_lisa(
mi
);
return False;
}
return False;
}
@@
-509,7
+514,7
@@
initlisa(ModeInfo * mi, lisas * loop)
if ((lp = loop->lastpoint = (XPoint *)
calloc(loop->nsteps+extra_points, sizeof (XPoint))) == NULL) {
if ((lp = loop->lastpoint = (XPoint *)
calloc(loop->nsteps+extra_points, sizeof (XPoint))) == NULL) {
- free_lisa(
lc
);
+ free_lisa(
mi
);
return False;
}
phase = lc->loopcount % loop->nsteps;
return False;
}
phase = lc->loopcount % loop->nsteps;
@@
-607,12
+612,13
@@
refreshlisa(ModeInfo * mi)
lisacons *lc = &Lisa[MI_SCREEN(mi)];
int lctr;
lisacons *lc = &Lisa[MI_SCREEN(mi)];
int lctr;
- for (lctr = 0; lctr < lc->nlisajous; lctr++) {
- if (!drawlisa(mi, &lc->lisajous[lctr]))
+ for (lctr = 0; lctr < lc->nlis
s
ajous; lctr++) {
+ if (!drawlisa(mi, &lc->lis
s
ajous[lctr]))
return;
}
}
return;
}
}
+#ifndef STANDALONE
ENTRYPOINT void
refresh_lisa(ModeInfo * mi)
{
ENTRYPOINT void
refresh_lisa(ModeInfo * mi)
{
@@
-621,7
+627,7
@@
refresh_lisa(ModeInfo * mi)
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
- if (lc->lisajous == NULL)
+ if (lc->lis
s
ajous == NULL)
return;
if (lc->painted) {
return;
if (lc->painted) {
@@
-630,6
+636,7
@@
refresh_lisa(ModeInfo * mi)
refreshlisa(mi);
}
}
refreshlisa(mi);
}
}
+#endif
static void
change_lisa(ModeInfo * mi)
static void
change_lisa(ModeInfo * mi)
@@
-641,12
+648,12
@@
change_lisa(ModeInfo * mi)
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
- if (lc->lisajous == NULL)
+ if (lc->lis
s
ajous == NULL)
return;
lc->loopcount = 0;
return;
lc->loopcount = 0;
- for (lctr = 0; lctr < lc->nlisajous; lctr++) {
- loop = &lc->lisajous[lctr]; /* count through the loops we're drawing */
+ for (lctr = 0; lctr < lc->nlis
s
ajous; lctr++) {
+ loop = &lc->lis
s
ajous[lctr]; /* count through the loops we're drawing */
newfunc = NRAND(NUMSTDFUNCS); /* choose a new function at random */
#if defined FOLLOW_FUNC_ORDER
loop->function[1] =
newfunc = NRAND(NUMSTDFUNCS); /* choose a new function at random */
#if defined FOLLOW_FUNC_ORDER
loop->function[1] =
@@
-679,27
+686,23
@@
init_lisa (ModeInfo * mi)
int lctr;
lisacons *lc;
int lctr;
lisacons *lc;
- if (Lisa == NULL) {
- if ((Lisa = (lisacons *) calloc(MI_NUM_SCREENS(mi),
- sizeof (lisacons))) == NULL)
- return;
- }
+ MI_INIT (mi, Lisa);
lc = &Lisa[MI_SCREEN(mi)];
lc->width = MI_WIDTH(mi);
lc->height = MI_HEIGHT(mi);
lc->loopcount = 0;
lc = &Lisa[MI_SCREEN(mi)];
lc->width = MI_WIDTH(mi);
lc->height = MI_HEIGHT(mi);
lc->loopcount = 0;
- lc->nlisajous = MI_COUNT(mi);
- if (lc->nlisajous <= 0)
- lc->nlisajous = 1;
+ lc->nlis
s
ajous = MI_COUNT(mi);
+ if (lc->nlis
s
ajous <= 0)
+ lc->nlis
s
ajous = 1;
MI_CLEARWINDOW(mi);
lc->painted = False;
MI_CLEARWINDOW(mi);
lc->painted = False;
- if (lc->lisajous == NULL) {
- if ((lc->lis
ajous = (lisas *) calloc(lc->nli
sajous,
+ if (lc->lis
s
ajous == NULL) {
+ if ((lc->lis
sajous = (lisas *) calloc(lc->nlis
sajous,
sizeof (lisas))) == NULL)
return;
sizeof (lisas))) == NULL)
return;
- for (lctr = 0; lctr < lc->nlisajous; lctr++) {
- if (!initlisa(mi, &lc->lisajous[lctr]))
+ for (lctr = 0; lctr < lc->nlis
s
ajous; lctr++) {
+ if (!initlisa(mi, &lc->lis
s
ajous[lctr]))
return;
lc->loopcount++;
}
return;
lc->loopcount++;
}
@@
-716,10
+719,10
@@
draw_lisa (ModeInfo * mi)
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
if (Lisa == NULL)
return;
lc = &Lisa[MI_SCREEN(mi)];
- if (lc->lisajous == NULL)
+ if (lc->lis
s
ajous == NULL)
return;
return;
-#ifdef HAVE_
COCOA
/* Don't second-guess Quartz's double-buffering */
+#ifdef HAVE_
JWXYZ
/* Don't second-guess Quartz's double-buffering */
XClearWindow (MI_DISPLAY(mi), MI_WINDOW(mi));
#endif
XClearWindow (MI_DISPLAY(mi), MI_WINDOW(mi));
#endif
@@
-731,19
+734,6
@@
draw_lisa (ModeInfo * mi)
refreshlisa(mi);
}
refreshlisa(mi);
}
-ENTRYPOINT void
-release_lisa (ModeInfo * mi)
-{
- if (Lisa) {
- int screen;
-
- for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++)
- free_lisa(&Lisa[screen]);
- (void) free(Lisa);
- Lisa = (lisacons *) NULL;
- }
-}
-
XSCREENSAVER_MODULE ("Lisa", lisa)
#endif /* MODE_lisa */
XSCREENSAVER_MODULE ("Lisa", lisa)
#endif /* MODE_lisa */