From f1b36138fefa3a9dc87742229388821fe5f26a2a Mon Sep 17 00:00:00 2001 From: Jan Wester Date: Thu, 16 Sep 2010 03:34:07 +0200 Subject: [PATCH] Fixed unnecessary loss of precision in HSL calculations. --- dialogs/ColourPickerDlg.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dialogs/ColourPickerDlg.cpp b/dialogs/ColourPickerDlg.cpp index 78db06c3..2b2cd11c 100644 --- a/dialogs/ColourPickerDlg.cpp +++ b/dialogs/ColourPickerDlg.cpp @@ -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; @@ -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) @@ -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)