projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http://www.tienza.es/crux/src/www.jwz.org/xscreensaver/xscreensaver-5.05.tar.gz
[xscreensaver]
/
hacks
/
bumps.c
diff --git
a/hacks/bumps.c
b/hacks/bumps.c
index c9f00bb40b9c12ddfc6412d98af59ca3217bd335..2f510f5a9b5a5b15487a21ddb4e457a5e953b223 100644
(file)
--- a/
hacks/bumps.c
+++ b/
hacks/bumps.c
@@
-346,7
+346,7
@@
static void InitBumpMap_2(Display *dpy, SBumps *pBumps)
while( nSoften-- )
softenMultiplier *= 1.0f + ( 1.0f / 3.0f ); /* Softening takes the max height down, so scale up to compensate. */
maxHeight = pBumps->SpotLight.nLightRadius * softenMultiplier;
while( nSoften-- )
softenMultiplier *= 1.0f + ( 1.0f / 3.0f ); /* Softening takes the max height down, so scale up to compensate. */
maxHeight = pBumps->SpotLight.nLightRadius * softenMultiplier;
- nAverager =
( 3 * 0xFFFF ) / maxHeight
;
+ nAverager =
maxHeight ? ( 3 * 0xFFFF ) / maxHeight : 0
;
pBump = pBumps->aBumpMap;
if( bInvert ) /* Funny, it's actually the 'else' that inverts the bump map... */
pBump = pBumps->aBumpMap;
if( bInvert ) /* Funny, it's actually the 'else' that inverts the bump map... */
@@
-361,7
+361,7
@@
static void InitBumpMap_2(Display *dpy, SBumps *pBumps)
pColor = pBumps->xColors;
for( iWidth=pBumps->iWinWidth; iWidth; --iWidth, ++pColor, ++pBump )
pColor = pBumps->xColors;
for( iWidth=pBumps->iWinWidth; iWidth; --iWidth, ++pColor, ++pBump )
-
*pBump = ( ( pColor->red + pColor->green + pColor->blue ) / nAverager
);
+
*pBump = ( nAverager ? ( pColor->red + pColor->green + pColor->blue ) / nAverager : 0
);
}
}
else
}
}
else
@@
-376,7
+376,7
@@
static void InitBumpMap_2(Display *dpy, SBumps *pBumps)
pColor = pBumps->xColors;
for( iWidth=pBumps->iWinWidth; iWidth; --iWidth, ++pColor, ++pBump )
pColor = pBumps->xColors;
for( iWidth=pBumps->iWinWidth; iWidth; --iWidth, ++pColor, ++pBump )
-
*pBump = ( maxHeight - ( ( pColor->red + pColor->green + pColor->blue ) / nAverager
) );
+
*pBump = ( maxHeight - ( nAverager ? ( pColor->red + pColor->green + pColor->blue ) / nAverager : 0
) );
}
}
}
}