Float to int is slow on ppc. It requires a store, a big stall, and then a load. It's even worse on a G5 if the compiler is dumb (and let's face it, I'm using gcc here...). Just use lroundf when we want an int. It will certainly be no slower.
This commit is contained in:
@@ -876,13 +876,13 @@ RageSurface *RageSurfaceUtils::PalettizeToGrayscale( const RageSurface *src_surf
|
||||
if( Ivalues == 1 )
|
||||
ScaledI = 255; // if only one intensity value, always fullbright
|
||||
else
|
||||
ScaledI = clamp( int(roundf(I * (255.0f / (Ivalues-1)))), 0, 255 );
|
||||
ScaledI = clamp( lroundf(I * (255.0f / (Ivalues-1))), 0L, 255L );
|
||||
|
||||
int ScaledA;
|
||||
if( Avalues == 1 )
|
||||
ScaledA = 255; // if only one alpha value, always opaque
|
||||
else
|
||||
ScaledA = clamp( int(roundf(A * (255.0f / (Avalues-1)))), 0, 255 );
|
||||
ScaledA = clamp( lroundf(A * (255.0f / (Avalues-1))), 0L, 255L );
|
||||
|
||||
RageSurfaceColor c;
|
||||
c.r = uint8_t(ScaledI);
|
||||
|
||||
Reference in New Issue
Block a user