From c7c6c2ce21ef368c1a7b298038c3cf70f6bbfb46 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 22 Dec 2010 14:15:50 +0100 Subject: [PATCH] Changed: #825 Remove all warnings when compiling Ryzom --- code/nel/src/misc/rgba.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/code/nel/src/misc/rgba.cpp b/code/nel/src/misc/rgba.cpp index 4746d4f56..844a100cf 100644 --- a/code/nel/src/misc/rgba.cpp +++ b/code/nel/src/misc/rgba.cpp @@ -615,25 +615,26 @@ bool CRGBA::convertToHLS(float &h, float &l, float &s) const float maxV = NLMISC::maxof(r, g, b); float minV = NLMISC::minof(r, g, b); - /// get lightness - l = 0.5f * (maxV + minV); - - /// Get saturation - if (minV == maxV) // all composants are equals -> achromatique + // all composants are equals -> achromatique + if (minV == maxV) { - h = 0; - s = 0; + h = 0.f; + l = minV; + s = 0.f; return true; } + // get lightness + l = 0.5f * (maxV + minV); + float diff = maxV - minV; - /// compute saturation + // get saturation s = l > 0.5f ? /*are we in the top of the double-hexcone ? */ diff / (2.f - maxV - minV) : diff / (maxV + minV); - // Get hue + // get hue if (maxV == r) { h = (g - b) / diff; @@ -691,10 +692,10 @@ static float HLSValue(float h, float v1, float v2) // *************************************************************************** void CRGBA::buildFromHLS(float h, float l, float s) { - clamp(l, 0, 1); - clamp(s, 0, 1); + clamp(l, 0.f, 1.f); + clamp(s, 0.f, 1.f); - float v2 = (l <= 0.5f) ? (l * (1 + s)) : (l + s - l * s); + float v2 = (l <= 0.5f) ? (l * (1.f + s)) : (l + s - l * s); float v1 = 2.f * l - v2; if (s == 0) // achromatic ?