From d6f29299a1220ba50ee0224118d1575492a10114 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 22 Dec 2010 01:00:28 +0100 Subject: [PATCH] Changed: #878 Fix typos in comments/code --- code/nel/src/misc/rgba.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/code/nel/src/misc/rgba.cpp b/code/nel/src/misc/rgba.cpp index 4ea71f307..dd8501270 100644 --- a/code/nel/src/misc/rgba.cpp +++ b/code/nel/src/misc/rgba.cpp @@ -37,14 +37,14 @@ namespace NLMISC { // predifined colors /// some colors - const CRGBA CRGBA::Black(0, 0, 0) ; - const CRGBA CRGBA::Red(255, 0, 0) ; - const CRGBA CRGBA::Green(0, 255, 0) ; - const CRGBA CRGBA::Yellow(255, 255, 0) ; - const CRGBA CRGBA::Blue(0, 0, 255) ; - const CRGBA CRGBA::Magenta(255, 0, 255) ; - const CRGBA CRGBA::Cyan(0, 255, 255) ; - const CRGBA CRGBA::White(255, 255, 255) ; +const CRGBA CRGBA::Black(0, 0, 0) ; +const CRGBA CRGBA::Red(255, 0, 0) ; +const CRGBA CRGBA::Green(0, 255, 0) ; +const CRGBA CRGBA::Yellow(255, 255, 0) ; +const CRGBA CRGBA::Blue(0, 0, 255) ; +const CRGBA CRGBA::Magenta(255, 0, 255) ; +const CRGBA CRGBA::Cyan(0, 255, 255) ; +const CRGBA CRGBA::White(255, 255, 255) ; // *************************************************************************** void CRGBA::serial(class NLMISC::IStream &f) @@ -407,6 +407,7 @@ void CRGBA::modulateColors(CRGBA *dest, const CRGBA *src1, const CRGBA *src2, ui } #endif } + // *************************************************************************** void CRGBA::subtractColors(CRGBA *dest, const CRGBA *src1, const CRGBA *src2, uint numColors, uint srcStride, uint destStride, uint dup) { @@ -583,6 +584,7 @@ void CBGRA::serial(class NLMISC::IStream &f) f.serial (R); f.serial (A); } + // *************************************************************************** void CBGRA::set(uint8 r, uint8 g, uint8 b, uint8 a) { @@ -591,18 +593,18 @@ void CBGRA::set(uint8 r, uint8 g, uint8 b, uint8 a) B = b; A = a; } + // *************************************************************************** void CBGRA::blendFromui(CBGRA &c0, CBGRA &c1, uint coef) // coef must be in [0,256] { - int a1 = coef; - int a2 = 256-a1; + sint a1 = coef; + sint a2 = 256-a1; R = (c0.R*a2 + c1.R*a1) >>8; G = (c0.G*a2 + c1.G*a1) >>8; B = (c0.B*a2 + c1.B*a1) >>8; A = (c0.A*a2 + c1.A*a1) >>8; } - // *************************************************************************** bool CRGBA::convertToHLS(float &h, float &l, float &s) const { @@ -623,14 +625,15 @@ bool CRGBA::convertToHLS(float &h, float &l, float &s) const s = 0; return true; } + float diff = maxV - minV; + /// compute saturation - s = l > 0.5f ? /*are we in the top of the double-hexcone ? */ + s = l > 0.5f ? /*are we in the top of the double-hexcone ? */ diff / (2.f - maxV - minV) : diff / (maxV + minV); // Get hue - if (maxV == r) { h = (g - b) / diff; @@ -651,7 +654,6 @@ bool CRGBA::convertToHLS(float &h, float &l, float &s) const return false; } - // *************************************************************************** /// Used by buildFromHLS static float HLSValue(float h, float v1, float v2) @@ -737,8 +739,4 @@ void CRGBAF::set(float r, float g, float b, float a) A = a; } - - - - } // NLMISC