neutrino: avoid float for color calculations

Origin commit data
------------------
Commit: bf86a07a0d
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-12-25 (Sun, 25 Dec 2011)
This commit is contained in:
Stefan Seyfried
2011-12-25 23:21:07 +01:00
parent 1b5b47b85f
commit ceefb08308

View File

@@ -39,9 +39,9 @@
int convertSetupColor2RGB(const unsigned char r, const unsigned char g, const unsigned char b)
{
unsigned char red = int( float(255./100.)*float(r) );
unsigned char green = int( float(255./100.)*float(g) );
unsigned char blue = int( float(255./100.)*float(b) );
unsigned char red = (int)r * 255 / 100;
unsigned char green = (int)g * 255 / 100;
unsigned char blue = (int)b * 255 / 100;
return (red << 16) | (green << 8) | blue;
}
@@ -50,8 +50,8 @@ int convertSetupAlpha2Alpha(unsigned char alpha)
{
if(alpha == 0) return 0xFF;
else if(alpha >= 100) return 0;
unsigned char a = 100 - alpha;
int ret = int( float(0xFF/100.)*float(a) );
int a = 100 - alpha;
int ret = a * 0xFF / 100;
return ret;
}
@@ -61,7 +61,7 @@ void recalcColor(unsigned char &orginal, int fade)
{
return;
}
int color = int( float( float(orginal) * float( float(fade) / 100.0)) );
int color = orginal * fade / 100;
if(color>255)
color=255;
if(color<0)