~ubuntu-branches/ubuntu/breezy/xscreensaver/breezy

« back to all changes in this revision

Viewing changes to hacks/lisa.c

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Grawert
  • Date: 2005-10-11 21:00:42 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20051011210042-u7q6zslgevdxspr3
Tags: 4.21-4ubuntu17
updated pt_BR again, fixed to UTF-8 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- Mode: C; tab-width: 4 -*- */
2
2
/* lisa --- animated full-loop lisajous figures */
3
3
 
4
 
#if !defined( lint ) && !defined( SABER )
5
 
static const char sccsid[] = "@(#)lisa.c        4.04 97/07/28 xlockmore";
 
4
#if 0
 
5
static const char sccsid[] = "@(#)lisa.c        5.00 2000/11/01 xlockmore";
6
6
#endif
7
7
 
8
 
/* Copyright (c) 1997 by Caleb Cullen.
 
8
/*-
 
9
 * Copyright (c) 1997 by Caleb Cullen.
9
10
 *
10
11
 * Permission to use, copy, modify, and distribute this software and its
11
12
 * documentation for any purpose and without fee is hereby granted,
20
21
 * other special, indirect and consequential damages.
21
22
 *
22
23
 * Revision History:
23
 
 * 10-May-97: Compatible with xscreensaver
 
24
 * 01-Nov-2000: Allocation checks
 
25
 * 10-May-1997: Compatible with xscreensaver
24
26
 *
25
 
 * The inspiration for this program, Lasp, was written by Adam B. Roach 
 
27
 * The inspiration for this program, Lasp, was written by Adam B. Roach
26
28
 * in 1990, assisted by me, Caleb Cullen.  It was written first in C, then
27
29
 * in assembly, and used pre-calculated data tables to graph lisajous
28
30
 * figures on 386 machines and lower.  This version bears only superficial
34
36
 */
35
37
 
36
38
#ifdef STANDALONE
37
 
# define PROGCLASS                                      "Lisa"
38
 
# define HACK_INIT                                      init_lisa
39
 
# define HACK_DRAW                                      draw_lisa
40
 
# define lisa_opts                                      xlockmore_opts
41
 
# define DEFAULTS       "*delay:                25000   \n"                     \
42
 
                                        "*count:                1       \n"                     \
43
 
                                        "*cycles:               256     \n"                     \
44
 
                                        "*size:                 -1      \n"                     \
45
 
                                        "*ncolors:              200     \n"
46
 
# define UNIFORM_COLORS
47
 
# include "xlockmore.h"                         /* from the xscreensaver distribution */
48
 
  void refresh_lisa(ModeInfo * mi);
49
 
  void change_lisa(ModeInfo * mi);
50
 
#else  /* !STANDALONE */
51
 
# include "xlock.h"                                     /* from the xlockmore distribution */
52
 
#endif /* !STANDALONE */
 
39
#define MODE_lisa
 
40
#define PROGCLASS "Lisa"
 
41
#define HACK_INIT init_lisa
 
42
#define HACK_DRAW draw_lisa
 
43
#define lisa_opts xlockmore_opts
 
44
#define DEFAULTS "*delay: 25000 \n" \
 
45
 "*count: 1 \n" \
 
46
 "*cycles: 256 \n" \
 
47
 "*size: -1 \n" \
 
48
 "*ncolors: 200 \n"
 
49
#define UNIFORM_COLORS
 
50
#include "xlockmore.h"          /* in xscreensaver distribution */
 
51
 
 
52
#else /* STANDALONE */
 
53
#include "xlock.h"              /* in xlockmore distribution */
 
54
 
 
55
#endif /* STANDALONE */
 
56
 
 
57
#ifdef MODE_lisa
53
58
 
54
59
#define  DEF_ADDITIVE     "True"
55
60
 
56
61
static Bool additive;
57
62
 
58
 
static XrmOptionDescRec lisa_xrm_opts[] =
59
 
{
60
 
        {"-additive", ".lisa.additive", XrmoptionNoArg, (caddr_t) "True"},
61
 
        {"+additive", ".lisa.additive", XrmoptionNoArg, (caddr_t) "False"}
62
 
};
63
 
 
64
 
static argtype lisa_vars[] =
65
 
{
66
 
        {(caddr_t *) & additive, "additive", "Additive", DEF_ADDITIVE, t_Bool}
67
 
};
68
 
 
69
 
static OptionStruct lisa_vars_desc[] =
 
63
static XrmOptionDescRec opts[] =
 
64
{
 
65
        {"-additive", ".lisa.additive", XrmoptionNoArg, "True"},
 
66
        {"+additive", ".lisa.additive", XrmoptionNoArg, "False"}
 
67
};
 
68
 
 
69
static argtype vars[] =
 
70
{
 
71
        {&additive, "additive", "Additive", DEF_ADDITIVE, t_Bool}
 
72
};
 
73
 
 
74
static OptionStruct desc[] =
70
75
{
71
76
        {"-/+additive", "turn on/off additive functions mode"}
72
77
};
73
78
 
74
79
ModeSpecOpt lisa_opts =
75
 
{2, lisa_xrm_opts, 1, lisa_vars, lisa_vars_desc};
76
 
 
 
80
{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc};
 
81
 
 
82
#ifdef USE_MODULES
 
83
ModStruct   lisa_description =
 
84
{"lisa", "init_lisa", "draw_lisa", "release_lisa",
 
85
 "refresh_lisa", "change_lisa", (char *) NULL, &lisa_opts,
 
86
 25000, 1, 256, -1, 64, 1.0, "",
 
87
 "Shows animated lisajous loops", 0, NULL};
 
88
 
 
89
#endif
77
90
 
78
91
#define  DRAWLINES    1
79
92
#define  TWOLOOPS     1
82
95
#define  LISAMAXFUNCS 2
83
96
#define  NUMSTDFUNCS  10
84
97
#define  MAXCYCLES    3
85
 
#define  MINLISAS 1
 
98
#define  MINLISAS     1
86
99
#define  lisasetcolor() \
87
100
if (MI_NPIXELS(mi) > 2) { \
88
101
  XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_PIXEL(mi, loop->color)); \
89
 
  if (++(loop->color) >= MI_NPIXELS(mi)) { loop->color=0; } \
90
 
  } else { XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_WHITE_PIXEL(mi)); }
 
102
  if (++(loop->color) >= (unsigned) MI_NPIXELS(mi)) { loop->color=0; } \
 
103
  } else { XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WHITE_PIXEL(mi)); }
91
104
#define getRadius(context) \
92
105
  ((context->width > context->height)?context->height:context->width) * 3 / 8
93
106
#define checkRadius(loop, context) \
105
118
} lisafuncs;
106
119
 
107
120
typedef struct lisa_struct {
108
 
        int         radius, color, dx, dy, nsteps, nfuncs, melting;
 
121
        unsigned long color;
 
122
        int         radius, dx, dy, nsteps, nfuncs, melting;
109
123
        double      pistep, phi, theta;
110
124
        XPoint      center, *lastpoint;
111
125
        lisafuncs  *function[LISAMAXFUNCS];
 
126
        int         linewidth;
112
127
} lisas;
113
128
 
114
129
typedef struct lisacontext_struct {
115
130
        lisas      *lisajous;
116
131
        int         width, height, nlisajous, loopcount;
117
132
        int         maxcycles;
 
133
        Bool        painted;
118
134
} lisacons;
119
135
 
120
 
static lisacons *Lisa = NULL;
 
136
static lisacons *Lisa = (lisacons *) NULL;
121
137
 
122
138
static lisafuncs Function[NUMSTDFUNCS] =
123
139
{
154
170
};
155
171
 
156
172
static void
 
173
free_lisa(lisacons *lc)
 
174
{
 
175
        while (lc->lisajous) {
 
176
                int    lctr;
 
177
 
 
178
                for (lctr = 0; lctr < lc->nlisajous; lctr++) {
 
179
                        (void) free((void *) lc->lisajous[lctr].lastpoint);
 
180
                }
 
181
                (void) free((void *) lc->lisajous);
 
182
                lc->lisajous = (lisas *) NULL;
 
183
        }
 
184
}
 
185
 
 
186
static Bool
157
187
drawlisa(ModeInfo * mi, lisas * loop)
158
188
{
159
189
        XPoint     *np;
165
195
        double      xprod, yprod, xsum, ysum;
166
196
 
167
197
        /* Allocate the np array */
168
 
        np = (XPoint *) calloc(loop->nsteps, sizeof (XPoint));
 
198
        if ((np = (XPoint *) calloc(loop->nsteps, sizeof (XPoint))) == NULL) {
 
199
                free_lisa(lc);
 
200
                return False;
 
201
        }
169
202
 
170
203
        /* Update the center */
171
204
        loop->center.x += loop->dx;
204
237
                                        yprod += sin(lf[fctr]->ycoeff[yctr] * loop->phi);
205
238
                                if (loop->melting) {
206
239
                                        if (fctr) {
207
 
                                                xsum += xprod \
208
 
                                                        *(double) (loop->nsteps - loop->melting) \
209
 
                                                        /(double) loop->nsteps;
210
 
                                                ysum += yprod \
211
 
                                                        *(double) (loop->nsteps - loop->melting) \
212
 
                                                        /(double) loop->nsteps;
 
240
                                                xsum += xprod * (double) (loop->nsteps - loop->melting) /
 
241
                                                        (double) loop->nsteps;
 
242
                                                ysum += yprod * (double) (loop->nsteps - loop->melting) /
 
243
                                                        (double) loop->nsteps;
213
244
                                        } else {
214
 
                                                xsum += xprod \
215
 
                                                        *(double) loop->melting \
216
 
                                                        /(double) loop->nsteps;
217
 
                                                ysum += yprod \
218
 
                                                        *(double) loop->melting \
219
 
                                                        /(double) loop->nsteps;
 
245
                                                xsum += xprod * (double) loop->melting / (double) loop->nsteps;
 
246
                                                ysum += yprod * (double) loop->melting / (double) loop->nsteps;
220
247
                                        }
221
248
                                } else {
222
249
                                        xsum = xprod;
223
250
                                        ysum = yprod;
224
251
                                }
225
252
                                if (!fctr) {
226
 
                                        xsum = xsum \
227
 
                                                *(double) loop->radius \
228
 
                                                /(double) lf[fctr]->nx;
229
 
                                        ysum = ysum \
230
 
                                                *(double) loop->radius \
231
 
                                                /(double) lf[fctr]->ny;
 
253
                                        xsum = xsum * (double) loop->radius / (double) lf[fctr]->nx;
 
254
                                        ysum = ysum * (double) loop->radius / (double) lf[fctr]->ny;
232
255
                                }
233
256
                        } else {
234
257
                                if (loop->melting) {
235
258
                                        if (fctr) {
236
 
                                                yprod = xprod = (double) loop->radius \
237
 
                                                        *(double) (loop->nsteps - loop->melting) \
238
 
                                                        /(double) (loop->nsteps);
 
259
                                                yprod = xprod = (double) loop->radius *
 
260
                                                        (double) (loop->nsteps - loop->melting) /
 
261
                                                        (double) (loop->nsteps);
239
262
                                        } else {
240
 
                                                yprod = xprod = (double) loop->radius \
241
 
                                                        *(double) (loop->melting) \
242
 
                                                        /(double) (loop->nsteps);
 
263
                                                yprod = xprod = (double) loop->radius *
 
264
                                                        (double) (loop->melting) / (double) (loop->nsteps);
243
265
                                        }
244
266
                                } else {
245
267
                                        xprod = yprod = (double) loop->radius;
271
293
        for (pctr = 0; pctr < loop->nsteps; pctr++) {
272
294
 
273
295
#if defined DRAWLINES
 
296
                XSetLineAttributes(MI_DISPLAY(mi), MI_GC(mi), loop->linewidth,
 
297
                                   LineSolid, CapProjecting, JoinMiter);
274
298
                /* erase the last cycle's point */
275
 
                XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_BLACK_PIXEL(mi));
276
 
                XDrawLine(MI_DISPLAY(mi), MI_WINDOW(mi), \
277
 
                          MI_GC(mi), lp[pctr].x, lp[pctr].y, \
278
 
                          lp[(pctr + 1) % loop->nsteps].x, \
 
299
                XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_BLACK_PIXEL(mi));
 
300
                XDrawLine(MI_DISPLAY(mi), MI_WINDOW(mi),
 
301
                          MI_GC(mi), lp[pctr].x, lp[pctr].y,
 
302
                          lp[(pctr + 1) % loop->nsteps].x,
279
303
                          lp[(pctr + 1) % loop->nsteps].y);
280
304
 
281
305
                /* Set the new color */
282
306
                lisasetcolor();
283
307
 
284
308
                /* plot this cycle's point */
285
 
                XDrawLine(MI_DISPLAY(mi), MI_WINDOW(mi), \
286
 
                          MI_GC(mi), np[pctr].x, np[pctr].y, \
287
 
                          np[(pctr + 1) % loop->nsteps].x, \
 
309
                XDrawLine(MI_DISPLAY(mi), MI_WINDOW(mi),
 
310
                          MI_GC(mi), np[pctr].x, np[pctr].y,
 
311
                          np[(pctr + 1) % loop->nsteps].x,
288
312
                          np[(pctr + 1) % loop->nsteps].y);
 
313
                XSetLineAttributes(MI_DISPLAY(mi), MI_GC(mi), 1,
 
314
                                   LineSolid, CapProjecting, JoinMiter);
289
315
#else
290
316
                /* erase the last cycle's point */
291
 
                XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_BLACK_PIXEL(mi));
292
 
                XDrawPoint(MI_DISPLAY(mi), MI_WINDOW(mi), \
 
317
                XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_BLACK_PIXEL(mi));
 
318
                XDrawPoint(MI_DISPLAY(mi), MI_WINDOW(mi),
293
319
                           MI_GC(mi), lp[pctr].x, lp[pctr].y);
294
320
 
295
321
                /* Set the new color */
296
322
                lisasetcolor();
297
323
 
298
324
                /* plot this cycle's point */
299
 
                XDrawPoint(MI_DISPLAY(mi), MI_WINDOW(mi), \
 
325
                XDrawPoint(MI_DISPLAY(mi), MI_WINDOW(mi),
300
326
                           MI_GC(mi), np[pctr].x, np[pctr].y);
301
327
#endif
302
328
        }
303
329
        (void) free((void *) lp);
304
330
        loop->lastpoint = np;
 
331
        return True;
305
332
}
306
333
 
307
 
static void
 
334
static Bool 
308
335
initlisa(ModeInfo * mi, lisas * loop)
309
336
{
310
337
        lisacons   *lc = &Lisa[MI_SCREEN(mi)];
316
343
        if (MI_NPIXELS(mi) > 2) {
317
344
                loop->color = 0;
318
345
        } else
319
 
                loop->color = MI_WIN_WHITE_PIXEL(mi);
 
346
                loop->color = MI_WHITE_PIXEL(mi);
320
347
        loop->nsteps = MI_CYCLES(mi);
321
348
        if (loop->nsteps == 0)
322
349
                loop->nsteps = 1;
326
353
        loop->pistep = 2.0 * M_PI / (double) loop->nsteps;
327
354
        loop->center.x = lc->width / 2;
328
355
        loop->center.y = lc->height / 2;
329
 
        loop->radius = MI_SIZE(mi);
 
356
        loop->radius = (int) MI_SIZE(mi);
330
357
        checkRadius(loop, lc);
331
358
        loop->dx = NRAND(XVMAX);
332
359
        loop->dy = NRAND(YVMAX);
334
361
        loop->dy++;
335
362
        lf[0] = &Function[lc->loopcount % NUMSTDFUNCS];
336
363
        if ((lp = loop->lastpoint = (XPoint *)
337
 
             calloc(loop->nsteps, sizeof (XPoint))) == NULL)
338
 
                return;
 
364
             calloc(loop->nsteps, sizeof (XPoint))) == NULL) {
 
365
                free_lisa(lc);
 
366
                return False;
 
367
        }
339
368
        phase = lc->loopcount % loop->nsteps;
340
369
 
341
370
        for (pctr = 0; pctr < loop->nsteps; pctr++) {
364
393
                lp[pctr].x = (int) ceil(xsum);
365
394
                lp[pctr].y = (int) ceil(ysum);
366
395
        }
 
396
#if defined DRAWLINES
 
397
        {
 
398
                loop->linewidth = -8;   /* #### make this a resource */
 
399
 
 
400
                if (loop->linewidth == 0)
 
401
                        loop->linewidth = 1;
 
402
                if (loop->linewidth < 0)
 
403
                        loop->linewidth = NRAND(-loop->linewidth) + 1;
 
404
                XSetLineAttributes(MI_DISPLAY(mi), MI_GC(mi), loop->linewidth,
 
405
                                   LineSolid, CapProjecting, JoinMiter);
 
406
        }
 
407
#endif
367
408
        for (pctr = 0; pctr < loop->nsteps; pctr++) {
368
409
                /* Set the color */
369
410
                lisasetcolor();
370
411
#if defined DRAWLINES
371
 
                XDrawLine(MI_DISPLAY(mi), MI_WINDOW(mi), \
372
 
                          MI_GC(mi), lp[pctr].x, lp[pctr].y, \
373
 
                          lp[(pctr + 1) % loop->nsteps].x, \
 
412
                XDrawLine(MI_DISPLAY(mi), MI_WINDOW(mi),
 
413
                          MI_GC(mi), lp[pctr].x, lp[pctr].y,
 
414
                          lp[(pctr + 1) % loop->nsteps].x,
374
415
                          lp[(pctr + 1) % loop->nsteps].y);
375
416
#else
376
 
                XDrawPoint(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi), \
 
417
                XDrawPoint(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
377
418
                           lp[pctr].x, lp[pctr].y);
378
419
#endif
379
420
        }
380
 
 
381
 
        {
382
 
          int line_width = -15;  /* #### make this a resource */
383
 
          if (line_width == 0)
384
 
                line_width = -8;
385
 
          if (line_width < 0)
386
 
                line_width = NRAND(-line_width)+1;
387
 
          XSetLineAttributes(MI_DISPLAY(mi), MI_GC(mi), line_width,
388
 
                                                 LineSolid, CapProjecting, JoinMiter);
 
421
#if defined DRAWLINES
 
422
        XSetLineAttributes(MI_DISPLAY(mi), MI_GC(mi), 1,
 
423
                           LineSolid, CapProjecting, JoinMiter);
 
424
#endif
 
425
        return True;
 
426
}
 
427
 
 
428
static void
 
429
refreshlisa(ModeInfo * mi)
 
430
{
 
431
        lisacons   *lc = &Lisa[MI_SCREEN(mi)];
 
432
        int         lctr;
 
433
 
 
434
        for (lctr = 0; lctr < lc->nlisajous; lctr++) {
 
435
                if (!drawlisa(mi, &lc->lisajous[lctr]))
 
436
                        return;
 
437
        }
 
438
}
 
439
 
 
440
void
 
441
refresh_lisa(ModeInfo * mi)
 
442
{
 
443
        lisacons   *lc;
 
444
 
 
445
        if (Lisa == NULL)
 
446
                return;
 
447
        lc = &Lisa[MI_SCREEN(mi)];
 
448
        if (lc->lisajous == NULL)
 
449
                return;
 
450
 
 
451
        if (lc->painted) {
 
452
                lc->painted = False;
 
453
                MI_CLEARWINDOW(mi);
 
454
                refreshlisa(mi);
 
455
        }
 
456
}
 
457
 
 
458
void
 
459
change_lisa(ModeInfo * mi)
 
460
{
 
461
        lisas      *loop;
 
462
        int         lctr;
 
463
        lisacons   *lc;
 
464
 
 
465
        if (Lisa == NULL)
 
466
                return;
 
467
        lc = &Lisa[MI_SCREEN(mi)];
 
468
        if (lc->lisajous == NULL)
 
469
                return;
 
470
 
 
471
        lc->loopcount = 0;
 
472
        for (lctr = 0; lctr < lc->nlisajous; lctr++) {
 
473
                loop = &lc->lisajous[lctr];
 
474
                loop->function[1] = &Function[(loop->function[0]->index + 1) %
 
475
                                              NUMSTDFUNCS];
 
476
                loop->melting = loop->nsteps - 1;
 
477
                loop->nfuncs = 2;
389
478
        }
390
479
}
391
480
 
392
481
void
393
482
init_lisa(ModeInfo * mi)
394
483
{
 
484
        int         lctr;
395
485
        lisacons   *lc;
396
 
        int         lctr;
397
486
 
398
487
        if (Lisa == NULL) {
399
 
                if ((Lisa = (lisacons *) calloc(MI_NUM_SCREENS(mi), sizeof (lisacons))) \
400
 
                    == NULL)
 
488
                if ((Lisa = (lisacons *) calloc(MI_NUM_SCREENS(mi),
 
489
                                 sizeof (lisacons))) == NULL)
401
490
                        return;
402
491
        }
403
492
        lc = &Lisa[MI_SCREEN(mi)];
404
 
        lc->width = MI_WIN_WIDTH(mi);
405
 
        lc->height = MI_WIN_HEIGHT(mi);
 
493
        lc->width = MI_WIDTH(mi);
 
494
        lc->height = MI_HEIGHT(mi);
406
495
        lc->loopcount = 0;
407
 
        lc->nlisajous = MI_BATCHCOUNT(mi);
 
496
        lc->nlisajous = MI_COUNT(mi);
408
497
        if (lc->nlisajous <= 0)
409
498
                lc->nlisajous = 1;
 
499
        MI_CLEARWINDOW(mi);
 
500
        lc->painted = False;
410
501
 
411
502
        if (lc->lisajous == NULL) {
412
 
                if ((lc->lisajous = (lisas *) calloc(lc->nlisajous, sizeof (lisas))) \
413
 
                    == NULL)
 
503
                if ((lc->lisajous = (lisas *) calloc(lc->nlisajous,
 
504
                                sizeof (lisas))) == NULL)
414
505
                        return;
415
 
                XClearWindow(MI_DISPLAY(mi), MI_WINDOW(mi));
416
506
                for (lctr = 0; lctr < lc->nlisajous; lctr++) {
417
 
                        initlisa(mi, &lc->lisajous[lctr]);
 
507
                        if (!initlisa(mi, &lc->lisajous[lctr]))
 
508
                                return;
418
509
                        lc->loopcount++;
419
510
                }
420
511
        } else {
421
 
                refresh_lisa(mi);
 
512
                refreshlisa(mi);
422
513
        }
423
 
        XClearWindow(MI_DISPLAY(mi), MI_WINDOW(mi));
424
514
}
425
515
 
426
516
void
427
517
draw_lisa(ModeInfo * mi)
428
518
{
429
 
        lisacons   *lc = &Lisa[MI_SCREEN(mi)];
430
 
 
 
519
        lisacons   *lc;
 
520
 
 
521
        if (Lisa == NULL)
 
522
                return;
 
523
        lc = &Lisa[MI_SCREEN(mi)];
 
524
        if (lc->lisajous == NULL)
 
525
                return;
 
526
 
 
527
        MI_IS_DRAWN(mi) = True;
 
528
        lc->painted = True;
431
529
        if (++lc->loopcount > lc->maxcycles) {
432
530
                change_lisa(mi);
433
531
        }
434
 
        refresh_lisa(mi);
435
 
}
436
 
 
437
 
void
438
 
refresh_lisa(ModeInfo * mi)
439
 
{
440
 
        lisacons   *lc = &Lisa[MI_SCREEN(mi)];
441
 
        int         lctr;
442
 
 
443
 
        for (lctr = 0; lctr < lc->nlisajous; lctr++) {
444
 
                drawlisa(mi, &lc->lisajous[lctr]);
445
 
        }
 
532
        refreshlisa(mi);
446
533
}
447
534
 
448
535
void
449
536
release_lisa(ModeInfo * mi)
450
537
{
451
 
        lisacons   *lc;
452
 
        int         lctr, sctr;
453
 
 
454
538
        if (Lisa) {
455
 
                for (sctr = 0; sctr < MI_NUM_SCREENS(mi); sctr++) {
456
 
                        lc = &Lisa[sctr];
457
 
                        while (lc->lisajous) {
458
 
                                for (lctr = 0; lctr < lc->nlisajous; lctr++) {
459
 
                                        (void) free(lc->lisajous[lctr].lastpoint);
460
 
                                }
461
 
                                (void) free(lc->lisajous);
462
 
                                lc->lisajous = NULL;
463
 
                        }
464
 
                }
 
539
                int    screen;
 
540
 
 
541
                for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++)
 
542
                        free_lisa(&Lisa[screen]);
465
543
                (void) free(Lisa);
466
 
                Lisa = NULL;
467
 
        }
468
 
}
469
 
 
470
 
void
471
 
change_lisa(ModeInfo * mi)
472
 
{
473
 
        lisacons   *lc = &Lisa[MI_SCREEN(mi)];
474
 
        lisas      *loop;
475
 
        int         lctr;
476
 
 
477
 
        lc->loopcount = 0;
478
 
        for (lctr = 0; lctr < lc->nlisajous; lctr++) {
479
 
                loop = &lc->lisajous[lctr];
480
 
                loop->function[1] = &Function[(loop->function[0]->index + 1) %
481
 
                                              NUMSTDFUNCS];
482
 
                loop->melting = loop->nsteps - 1;
483
 
                loop->nfuncs = 2;
484
 
        }
485
 
}
 
544
                Lisa = (lisacons *) NULL;
 
545
        }
 
546
}
 
547
 
 
548
#endif /* MODE_lisa */