-/* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997, 1998, 2004, 2006
- * Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1992-2011 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
/*inline*/ static int rnd( int q )
{
-
+ if (q < 1) q = 1;
return random() % q;
}
tang = 90;
else
tang = 270;
- }
- if ( y1 == y2 ) {
+ } else if ( y1 == y2 ) {
if ( x1 < x2 )
tang = 0;
else
tang = 180;
- } else
- tang = (int)(0.5+atan2( -(y2-y1), x2 - x1 ) * 180.0 / M_PI );
+ } else {
+ tang = (int)(0.5+atan2( -(y2-y1), x2 - x1 ) * 180.0 / M_PI );
+ }
while ( tang < 0 )
tang += 360;
{
int q;
- int min, max;
XColor old_color, new_color;
ch->shade_max = 2048;
initXColor( &new_color );
for ( q = 0; q < ch->shade_max; q += ch->shade_use ){
- min = q;
- max = q + ch->shade_use;
- if ( max >= ch->shade_max ) max = ch->shade_max-1;
blend_palette( ch->shade + q, ch->shade_use, &old_color, &new_color );
old_color = new_color;