Skip to content

Commit

Permalink
Fixed unnecessary loss of precision in HSL calculations.
Browse files Browse the repository at this point in the history
  • Loading branch information
worstje committed Sep 16, 2010
1 parent 17c0fa5 commit f1b3613
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions dialogs/ColourPickerDlg.cpp
Expand Up @@ -160,8 +160,8 @@ int iResult = 0;

case eColourHue:
{
float hue1 = clr1.GetHue ();
float hue2 = clr2.GetHue ();
double hue1 = clr1.GetHue ();
double hue2 = clr2.GetHue ();
if (hue1 < hue2)
{
iResult = -1;
Expand All @@ -177,16 +177,16 @@ int iResult = 0;
// hue the same - fall through and compare saturation (then luminance)
case eColourSaturation:
{
float saturation1 = clr1.GetSaturation ();
float saturation2 = clr2.GetSaturation ();
double saturation1 = clr1.GetSaturation ();
double saturation2 = clr2.GetSaturation ();
if (saturation1 < saturation2)
iResult = -1;
else if (saturation1 > saturation2)
iResult = 1;
else
{ // saturation the same - compare luminance
float luminance1 = clr1.GetLuminance ();
float luminance2 = clr2.GetLuminance ();
double luminance1 = clr1.GetLuminance ();
double luminance2 = clr2.GetLuminance ();
if (luminance1 < luminance2)
iResult = -1;
else if (luminance1 > luminance2)
Expand All @@ -197,16 +197,16 @@ int iResult = 0;

case eColourLuminance:
{
float luminance1 = clr1.GetLuminance ();
float luminance2 = clr2.GetLuminance ();
double luminance1 = clr1.GetLuminance ();
double luminance2 = clr2.GetLuminance ();
if (luminance1 < luminance2)
iResult = -1;
else if (luminance1 > luminance2)
iResult = 1;
else
{ // luminance the same - compare saturation
float saturation1 = clr1.GetSaturation ();
float saturation2 = clr2.GetSaturation ();
double saturation1 = clr1.GetSaturation ();
double saturation2 = clr2.GetSaturation ();
if (saturation1 < saturation2)
iResult = -1;
else if (saturation1 > saturation2)
Expand Down

0 comments on commit f1b3613

Please sign in to comment.