-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1997, 2002 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
k = 0;
for (i = 0; i < npoints; i++)
{
- int distance, direction;
- distance = h[(i+1) % npoints] - h[i];
- direction = (distance >= 0 ? -1 : 1);
-
- if (distance > 180)
- distance = 180 - (distance - 180);
- else if (distance < -180)
- distance = -(180 - ((-distance) - 180));
- else
- direction = -direction;
+ int distance = h[(i+1) % npoints] - h[i];
+ int direction = (distance >= 0 ? -1 : 1);
+
+ if (distance <= 180 && distance >= -180)
+ direction = -direction;
#ifdef DEBUG
fprintf (stderr, "point %d: %3d %.2f %.2f\n",
double total_s = 0;
double total_v = 0;
Screen *screen = (dpy ? DefaultScreenOfDisplay(dpy) : 0); /* #### WRONG! */
+ int loop = 0;
if (*ncolorsP <= 0) return;
for (i = 0; i < npoints; i++)
{
REPICK_THIS_COLOR:
+ if (++loop > 10000) abort();
h[i] = random() % 360;
s[i] = frand(1.0);
v[i] = frand(0.8) + 0.2;
allocate_p, (writable_pP && *writable_pP));
/* If we tried for writable cells and got none, try for non-writable. */
- if (allocate_p && *ncolorsP == 0 && *writable_pP)
+ if (allocate_p && *ncolorsP == 0 && writable_pP && *writable_pP)
{
*writable_pP = False;
goto RETRY_NON_WRITABLE;
0, S, V,
359, S, V,
colors, &ncolors,
- False, True,
+ False, allocate_p,
(writable_pP && *writable_pP));
/* If we tried for writable cells and got none, try for non-writable. */