summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-01-13 01:02:30 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-01-12 06:14:48 +0000
commitc5e4417d6d608b00782d1e2a154cfdfd2b374392 (patch)
tree59423e7961c870a74f633f27843bee6825f45035
parent0ea39eb8420229a6ec96ed2bb0345c54d5cde976 (diff)
QColor: fix misleading code in op==
For HSL colors, the (heavily over-parenthesized) code compared hslHue values mod 36000, _and also_ for equality. Of course, the second comparison is dead code. This was a cut'n'paste error from the non-HSL comparison. So, remove it. And also some of the over-parenthesization. There are no tests for operator==, and the HSL color comparison is completely opaque for me, so I'm not going to write any for this trivial change. Change-Id: I74572273730cb5cc9f427c524c268ba3f90304c1 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
-rw-r--r--src/gui/painting/qcolor.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 3f30c061dc..1f92c8b145 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2415,8 +2415,7 @@ bool QColor::operator==(const QColor &color) const
{
if (cspec == Hsl && cspec == color.cspec) {
return (ct.argb.alpha == color.ct.argb.alpha
- && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000)))
- || (ct.ahsl.hue == color.ct.ahsl.hue))
+ && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000
&& (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50
|| ct.ahsl.lightness == 0
|| color.ct.ahsl.lightness == 0