summaryrefslogtreecommitdiff
path: root/src/post/goom/ifs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/goom/ifs.c')
-rw-r--r--src/post/goom/ifs.c81
1 files changed, 40 insertions, 41 deletions
diff --git a/src/post/goom/ifs.c b/src/post/goom/ifs.c
index fa1c2c190..985e0d5b2 100644
--- a/src/post/goom/ifs.c
+++ b/src/post/goom/ifs.c
@@ -33,7 +33,7 @@ static const char sccsid[] = "@(#)ifs.c 5.00 2002/04/11 baffe";
* that onto the screen, to reduce flicker.
*/
-/*#ifdef STANDALONE */
+//#ifdef STANDALONE
#include <math.h>
#include <stdlib.h>
@@ -55,24 +55,24 @@ static const char sccsid[] = "@(#)ifs.c 5.00 2002/04/11 baffe";
#define SMOOTH_COLORS
-/*#include "xlockmore.h" */ /* in xscreensaver distribution */
-/*#else */ /* STANDALONE */
-/*#include "xlock.h" */ /* in xlockmore distribution */
-/*#endif */ /* STANDALONE */
+//#include "xlockmore.h" /* in xscreensaver distribution */
+//#else /* STANDALONE */
+//#include "xlock.h" /* in xlockmore distribution */
+//#endif /* STANDALONE */
-/*#ifdef MODE_ifs */
+//#ifdef MODE_ifs
-/*ModeSpecOpt ifs_opts = */
-/*{0, (XrmOptionDescRec *) NULL, 0, (argtype *) NULL, (OptionStruct *) NULL}; */
+//ModeSpecOpt ifs_opts =
+//{0, (XrmOptionDescRec *) NULL, 0, (argtype *) NULL, (OptionStruct *) NULL};
-/*#ifdef USE_MODULES */
-/*ModStruct ifs_description = */
-/*{"ifs", "init_ifs", "draw_ifs", "release_ifs", */
-/* "init_ifs", "init_ifs", (char *) NULL, &ifs_opts, */
-/* 1000, 1, 1, 1, 64, 1.0, "", */
-/* "Shows a modified iterated function system", 0, NULL}; */
+//#ifdef USE_MODULES
+//ModStruct ifs_description =
+//{"ifs", "init_ifs", "draw_ifs", "release_ifs",
+// "init_ifs", "init_ifs", (char *) NULL, &ifs_opts,
+// 1000, 1, 1, 1, 64, 1.0, "",
+// "Shows a modified iterated function system", 0, NULL};
-/*#endif */
+//#endif
#include "goom_tools.h"
@@ -137,8 +137,8 @@ struct Fractal_Struct
int Cur_Pt, Max_Pt;
IFSPoint *Buffer1, *Buffer2;
-/* Pixmap dbuf; */
-/* GC dbuf_gc; */
+// Pixmap dbuf;
+// GC dbuf_gc;
};
static FRACTAL *Root = (FRACTAL *) NULL, *Cur_F;
@@ -214,7 +214,7 @@ init_ifs (int width, int height)
int i;
FRACTAL *Fractal;
-/* printf ("initing ifs\n"); */
+// printf ("initing ifs\n");
if (Root == NULL) {
Root = (FRACTAL *) malloc (sizeof (FRACTAL));
@@ -225,9 +225,9 @@ init_ifs (int width, int height)
}
Fractal = Root;
-/* fprintf (stderr,"--ifs freeing ex-buffers\n"); */
+// fprintf (stderr,"--ifs freeing ex-buffers\n");
free_ifs_buffers (Fractal);
-/* fprintf (stderr,"--ifs ok\n"); */
+// fprintf (stderr,"--ifs ok\n");
i = (NRAND (4)) + 2; /* Number of centers */
switch (i) {
@@ -260,7 +260,7 @@ init_ifs (int width, int height)
Fractal->dr2_mean = .4;
break;
}
-/* fprintf( stderr, "N=%d\n", i ); */
+// fprintf( stderr, "N=%d\n", i );
Fractal->Nb_Simi = i;
Fractal->Max_Pt = Fractal->Nb_Simi - 1;
for (i = 0; i <= Fractal->Depth + 2; ++i)
@@ -277,7 +277,7 @@ init_ifs (int width, int height)
return;
}
-/* printf ("--ifs setting params\n"); */
+// printf ("--ifs setting params\n");
Fractal->Speed = 6;
Fractal->Width = width; /* modif by JeKo */
Fractal->Height = height; /* modif by JeKo */
@@ -295,9 +295,8 @@ init_ifs (int width, int height)
* XFreePixmap(display, Fractal->dbuf);
* Fractal->dbuf = XCreatePixmap(display, window,
* Fractal->Width, Fractal->Height, 1);
- */
- /* Allocation checked */
- /* if (Fractal->dbuf != None) {
+ * /* Allocation checked *
+ * if (Fractal->dbuf != None) {
* XGCValues gcv;
*
* gcv.foreground = 0;
@@ -321,10 +320,10 @@ init_ifs (int width, int height)
* }
* #endif
*/
- /* MI_CLEARWINDOW(mi); */
+ // MI_CLEARWINDOW(mi);
/* don't want any exposure events from XCopyPlane */
- /* XSetGraphicsExposures(display, gc, False); */
+ // XSetGraphicsExposures(display, gc, False);
}
@@ -342,21 +341,21 @@ Transform (SIMI * Simi, F_PT xo, F_PT yo, F_PT * x, F_PT * y)
F_PT xx, yy;
xo = xo - Simi->Cx;
- xo = (xo * Simi->R) / UNIT;
+ xo = (xo * Simi->R) >> FIX; // / UNIT;
yo = yo - Simi->Cy;
- yo = (yo * Simi->R) / UNIT;
+ yo = (yo * Simi->R) >> FIX; // / UNIT;
xx = xo - Simi->Cx;
- xx = (xx * Simi->R2) / UNIT;
+ xx = (xx * Simi->R2) >> FIX; // / UNIT;
yy = -yo - Simi->Cy;
- yy = (yy * Simi->R2) / UNIT;
+ yy = (yy * Simi->R2) >> FIX; // / UNIT;
*x =
- ((xo * Simi->Ct - yo * Simi->St + xx * Simi->Ct2 - yy * Simi->St2) /
- UNIT) + Simi->Cx;
+ ((xo * Simi->Ct - yo * Simi->St + xx * Simi->Ct2 - yy * Simi->St2)
+ >> FIX /* / UNIT */ ) + Simi->Cx;
*y =
- ((xo * Simi->St + yo * Simi->Ct + xx * Simi->St2 + yy * Simi->Ct2) /
- UNIT) + Simi->Cy;
+ ((xo * Simi->St + yo * Simi->Ct + xx * Simi->St2 + yy * Simi->Ct2)
+ >> FIX /* / UNIT */ ) + Simi->Cy;
}
/***************************************************************/
@@ -371,8 +370,8 @@ Trace (FRACTAL * F, F_PT xo, F_PT yo)
for (i = Cur_F->Nb_Simi; i; --i, Cur++) {
Transform (Cur, xo, yo, &x, &y);
- Buf->x = F->Lx + (x * F->Lx / (UNIT * 2));
- Buf->y = F->Ly - (y * F->Ly / (UNIT * 2));
+ Buf->x = F->Lx + ((x * F->Lx) >> (FIX+1) /* /(UNIT*2) */ );
+ Buf->y = F->Ly - ((y * F->Ly) >> (FIX+1) /* /(UNIT*2) */ );
Buf++;
Cur_Pt++;
@@ -468,7 +467,7 @@ draw_ifs ( /* ModeInfo * mi */ int *nbpt)
if (Root == NULL)
return NULL;
- F = Root; /* [ */ /*MI_SCREEN(mi)*/ /* 0]; */
+ F = Root; // [/*MI_SCREEN(mi)*/0];
if (F->Buffer1 == NULL)
return NULL;
@@ -496,7 +495,7 @@ draw_ifs ( /* ModeInfo * mi */ int *nbpt)
S->A2 = u0 * S1->A2 + u1 * S2->A2 + u2 * S3->A2 + u3 * S4->A2;
}
- /* MI_IS_DRAWN(mi) = True; */
+ // MI_IS_DRAWN(mi) = True;
Draw_Fractal ( /* mi */ );
@@ -538,7 +537,7 @@ draw_ifs ( /* ModeInfo * mi */ int *nbpt)
/***************************************************************/
void
-release_ifs (void)
+release_ifs ()
{
if (Root != NULL) {
(void) free ((void *) Root);
@@ -546,4 +545,4 @@ release_ifs (void)
}
}
-/*#endif */ /* MODE_ifs */
+//#endif /* MODE_ifs */