beim Untersuchen von etwas ganz anderem fiel mir der folgende Code in neutrino/src/gui/color.cpp auf:
Code: Alles auswählen
Index: apps/tuxbox/neutrino/src/gui/color.cpp
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/src/gui/color.cpp,v
retrieving revision 1.9
diff -u -p -r1.9 color.cpp
--- a/apps/tuxbox/neutrino/src/gui/color.cpp 14 Mar 2004 22:28:13 -0000 1.9
+++ b/apps/tuxbox/neutrino/src/gui/color.cpp 1 Sep 2007 20:40:42 -0000
@@ -38,16 +38,16 @@
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;
}
int convertSetupAlpha2Alpha(unsigned char alpha)
{
- return int( float(0x7777/100.)*float(alpha) );
+ return int( 0x7777*int(alpha)/100 );
}
void recalcColor(unsigned char &orginal, int fade)
@@ -56,7 +56,7 @@ void recalcColor(unsigned char &orginal,
{
return;
}
- int color = int( float( float(orginal) * float( float(fade) / 100.0)) );
+ int color = int(orginal) * fade / 100;
if(color>255)
color=255;
if(color<0)