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.40.tar.gz
[xscreensaver]
/
hacks
/
flow.c
diff --git
a/hacks/flow.c
b/hacks/flow.c
index d69a7cc659c21dd30f10891579abf7e75ac16e45..6dddd8e0a99434eae64279f7f3e805c6592567ff 100644
(file)
--- a/
hacks/flow.c
+++ b/
hacks/flow.c
@@
-2,10
+2,8
@@
/* flow --- flow of strange bees */
#if 0
/* flow --- flow of strange bees */
#if 0
-#if !defined( lint ) && !defined( SABER )
static const char sccsid[] = "@(#)flow.c 5.00 2000/11/01 xlockmore";
#endif
static const char sccsid[] = "@(#)flow.c 5.00 2000/11/01 xlockmore";
#endif
-#endif
/*-
* Copyright (c) 1996 by Tim Auckland <tda10.geo@yahoo.com>
/*-
* Copyright (c) 1996 by Tim Auckland <tda10.geo@yahoo.com>
@@
-98,20
+96,16
@@
static const char sccsid[] = "@(#)flow.c 5.00 2000/11/01 xlockmore";
#ifdef STANDALONE
# define MODE_flow
#ifdef STANDALONE
# define MODE_flow
-# define PROGCLASS "Flow"
-# define HACK_INIT init_flow
-# define HACK_DRAW draw_flow
-# define flow_opts xlockmore_opts
# define DEFAULTS "*delay: 10000 \n" \
# define DEFAULTS "*delay: 10000 \n" \
- "*count: 3000 \n" \
- "*size: -10 \n" \
- "*cycles: 10000 \n" \
- "*ncolors: 200 \n" \
-
+ "*count: 3000 \n" \
+ "*size: -10 \n" \
+ "*cycles: 10000 \n" \
+ "*ncolors: 200 \n"
+
+# define release_flow 0
+# define reshape_flow 0
+# define flow_handle_event 0
# include "xlockmore.h" /* in xscreensaver distribution */
# include "xlockmore.h" /* in xscreensaver distribution */
-# ifndef MI_DEPTH
-# define MI_DEPTH MI_WIN_DEPTH
-# endif
#else /* STANDALONE */
# include "xlock.h" /* in xlockmore distribution */
#endif /* STANDALONE */
#else /* STANDALONE */
# include "xlock.h" /* in xlockmore distribution */
#endif /* STANDALONE */
@@
-165,14
+159,14
@@
static OptionStruct desc[] = {
{"-/+dbuf", "turn on/off double buffering."},
};
{"-/+dbuf", "turn on/off double buffering."},
};
-ModeSpecOpt flow_opts =
+
ENTRYPOINT
ModeSpecOpt flow_opts =
{sizeof opts / sizeof opts[0], opts,
sizeof vars / sizeof vars[0], vars, desc};
#ifdef USE_MODULES
ModStruct flow_description = {
{sizeof opts / sizeof opts[0], opts,
sizeof vars / sizeof vars[0], vars, desc};
#ifdef USE_MODULES
ModStruct flow_description = {
- "flow", "init_flow", "draw_flow",
"release_flow"
,
- "refresh_flow", "init_flow",
NULL
, &flow_opts,
+ "flow", "init_flow", "draw_flow",
NULL
,
+ "refresh_flow", "init_flow",
"free_flow"
, &flow_opts,
1000, 1024, 10000, -10, 200, 1.0, "",
"Shows dynamic strange attractors", 0, NULL
};
1000, 1024, 10000, -10, 200, 1.0, "",
"Shows dynamic strange attractors", 0, NULL
};
@@
-394,11
+388,12
@@
Iterate(dvector *p, dvector(*ODE)(Par par, double x, double y, double z),
#define deallocate(p,t) if (p!=NULL) {free(p); p=(t*)NULL; }
#define allocate(p,t,s) if ((p=(t*)malloc(sizeof(t)*s))==NULL)\
#define deallocate(p,t) if (p!=NULL) {free(p); p=(t*)NULL; }
#define allocate(p,t,s) if ((p=(t*)malloc(sizeof(t)*s))==NULL)\
-{free_flow(
sp
);return;}
+{free_flow(
mi
);return;}
-
static
void
-free_flow(
flowstruct *sp
)
+
ENTRYPOINT
void
+free_flow(
ModeInfo * mi
)
{
{
+ flowstruct *sp = &flows[MI_SCREEN(mi)];
deallocate(sp->csegs, XSegment);
deallocate(sp->cnsegs, int);
deallocate(sp->old_segs, XSegment);
deallocate(sp->csegs, XSegment);
deallocate(sp->cnsegs, int);
deallocate(sp->old_segs, XSegment);
@@
-627,17
+622,13
@@
clip(double nx, double ny, double nz, double d, dvector *s, dvector *e)
* Public functions
*/
* Public functions
*/
-void
-init_flow(ModeInfo * mi)
+
ENTRYPOINT
void
+init_flow
(ModeInfo * mi)
{
flowstruct *sp;
char *name;
{
flowstruct *sp;
char *name;
- if (flows == NULL) {
- if ((flows = (flowstruct *) calloc(MI_NUM_SCREENS(mi),
- sizeof (flowstruct))) == NULL)
- return;
- }
+ MI_INIT (mi, flows);
sp = &flows[MI_SCREEN(mi)];
sp->count2 = 0;
sp = &flows[MI_SCREEN(mi)];
sp->count2 = 0;
@@
-779,12
+770,17
@@
init_flow(ModeInfo * mi)
sp->count2 = 0; /* Reset search */
sp->count2 = 0; /* Reset search */
- free_flow(sp);
sp->beecount = MI_COUNT(mi);
sp->beecount = MI_COUNT(mi);
- if (sp->beecount < 0) { /* random variations */
+ if (!sp->beecount) {
+ sp->beecount = 1; /* The camera requires 1 or more */
+ } else if (sp->beecount < 0) { /* random variations */
sp->beecount = NRAND(-sp->beecount) + 1; /* Minimum 1 */
}
sp->beecount = NRAND(-sp->beecount) + 1; /* Minimum 1 */
}
+# ifdef HAVE_JWXYZ /* Don't second-guess Quartz's double-buffering */
+ dbufp = False;
+# endif
+
if(dbufp) { /* Set up double buffer */
if (sp->buffer != None)
XFreePixmap(MI_DISPLAY(mi), sp->buffer);
if(dbufp) { /* Set up double buffer */
if (sp->buffer != None)
XFreePixmap(MI_DISPLAY(mi), sp->buffer);
@@
-808,7
+804,7
@@
init_flow(ModeInfo * mi)
allocate(sp->csegs, XSegment,
(sp->beecount + BOX_L) * MI_NPIXELS(mi) * sp->taillen);
allocate(sp->cnsegs, int, MI_NPIXELS(mi));
allocate(sp->csegs, XSegment,
(sp->beecount + BOX_L) * MI_NPIXELS(mi) * sp->taillen);
allocate(sp->cnsegs, int, MI_NPIXELS(mi));
- allocate(sp->old_segs, XSegment,
sp->beecount
* sp->taillen);
+ allocate(sp->old_segs, XSegment,
(sp->beecount + BOX_L)
* sp->taillen);
allocate(sp->p, dvector, sp->beecount * sp->taillen);
}
allocate(sp->p, dvector, sp->beecount * sp->taillen);
}
@@
-821,8
+817,8
@@
init_flow(ModeInfo * mi)
Z(1, 0) = sp->cam[1].z = 0;
}
Z(1, 0) = sp->cam[1].z = 0;
}
-void
-draw_flow(ModeInfo * mi)
+
ENTRYPOINT
void
+draw_flow
(ModeInfo * mi)
{
int b, i;
int col, begin, end;
{
int b, i;
int col, begin, end;
@@
-837,6
+833,10
@@
draw_flow(ModeInfo * mi)
if (sp->csegs == NULL)
return;
if (sp->csegs == NULL)
return;
+#ifdef HAVE_JWXYZ /* Don't second-guess Quartz's double-buffering */
+ XClearWindow (MI_DISPLAY(mi), MI_WINDOW(mi));
+#endif
+
/* multiplier for indexing segment arrays. Used in IX macro, etc. */
segindex = (sp->beecount + BOX_L) * sp->taillen;
/* multiplier for indexing segment arrays. Used in IX macro, etc. */
segindex = (sp->beecount + BOX_L) * sp->taillen;
@@
-1108,7
+1108,7
@@
draw_flow(ModeInfo * mi)
are ok, they help to outline the Poincare'
slice. */
for(j = i; j < end; j++) Y(j,b) = Y(i,b);
are ok, they help to outline the Poincare'
slice. */
for(j = i; j < end; j++) Y(j,b) = Y(i,b);
- begin = i + 1;
+ /*begin = i + 1;*/
break;
}
break;
}
@@
-1198,23
+1198,14
@@
draw_flow(ModeInfo * mi)
}
}
}
}
-void
-release_flow(ModeInfo * mi)
-{
- if (flows != NULL) {
- int screen;
-
- for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++)
- free_flow(&flows[screen]);
- free(flows);
- flows = (flowstruct *) NULL;
- }
-}
-
-void
-refresh_flow(ModeInfo * mi)
+#ifndef STANDALONE
+ENTRYPOINT void
+refresh_flow (ModeInfo * mi)
{
if(!dbufp) MI_CLEARWINDOW(mi);
}
{
if(!dbufp) MI_CLEARWINDOW(mi);
}
+#endif
+
+XSCREENSAVER_MODULE ("Flow", flow)
#endif /* MODE_flow */
#endif /* MODE_flow */