From 176460cf800aaf5c193cca9a3cc0716b0731f2ad Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Fri, 7 Feb 2014 02:01:45 +0100 Subject: [PATCH] src/gui/color.cpp: Fix compiler warnings (-Wconversion) --- src/gui/color.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/color.cpp b/src/gui/color.cpp index 99c44bb22..7bc2ec4d0 100644 --- a/src/gui/color.cpp +++ b/src/gui/color.cpp @@ -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 = (unsigned char)( float(2.55)*float(r) ); + unsigned char green = (unsigned char)( float(2.55)*float(g) ); + unsigned char blue = (unsigned char)( float(2.55)*float(b) ); 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) ); + unsigned char a = (unsigned char)(100 - alpha); + int ret = int( float(2.55)*float(a) ); return ret; } @@ -66,7 +66,7 @@ void recalcColor(unsigned char &orginal, int fade) color=255; if(color<0) color=0; - orginal = color; + orginal = (unsigned char)color; } void protectColor( unsigned char &r, unsigned char &g, unsigned char &b, bool protect )