summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qcolor.cpp
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-10-10 12:58:12 +0100
committermread <qt-info@nokia.com>2011-10-10 13:23:08 +0100
commitae620eb773a5fd217de4766fc829e51417cb9e70 (patch)
tree8f1468cdc0f7fbb82a934b7370cc6a1b9aae5df2 /src/gui/painting/qcolor.cpp
parent22d475e1ef32875c4933b2bb4c2830cb1bdd3266 (diff)
Converting from double to qreal in gui
There were a number of places in QtGui where doubles were used in expressions due to the use of floating point constants in the code. Many of these constants are now constructed as qreal, removing the use of double operations where unneeded. These changes have been limited to constants that have exactly the same value whether double or float, to ensure that precision errors are not introduced. This should not affect any of the desktop platforms where qreal is double. On Symbian, where qreal is float, appropriate autotests have been run. Task-number: QTBUG-4894 Reviewed-by: Sami Merila
Diffstat (limited to 'src/gui/painting/qcolor.cpp')
-rw-r--r--src/gui/painting/qcolor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 3d895b7753..2fe68a8e58 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -1578,7 +1578,7 @@ QColor QColor::toRgb() const
}
// chromatic case
- const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / 6000.;
+ const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / qreal(6000.);
const qreal s = ct.ahsv.saturation / qreal(USHRT_MAX);
const qreal v = ct.ahsv.value / qreal(USHRT_MAX);
const int i = int(h);
@@ -1638,7 +1638,7 @@ QColor QColor::toRgb() const
color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0;
} else {
// chromatic case
- const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / 36000.;
+ const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / qreal(36000.);
const qreal s = ct.ahsl.saturation / qreal(USHRT_MAX);
const qreal l = ct.ahsl.lightness / qreal(USHRT_MAX);