From c5e4417d6d608b00782d1e2a154cfdfd2b374392 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 13 Jan 2015 01:02:30 +0100 Subject: 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) --- src/gui/painting/qcolor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3