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>
This commit is contained in:
Marc Mutz 2015-01-13 01:02:30 +01:00
parent 0ea39eb842
commit c5e4417d6d

View File

@ -2415,8 +2415,7 @@ bool QColor::operator==(const QColor &color) const
{ {
if (cspec == Hsl && cspec == color.cspec) { if (cspec == Hsl && cspec == color.cspec) {
return (ct.argb.alpha == color.ct.argb.alpha return (ct.argb.alpha == color.ct.argb.alpha
&& ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) && ct.ahsl.hue % 36000 == color.ct.ahsl.hue % 36000
|| (ct.ahsl.hue == color.ct.ahsl.hue))
&& (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50
|| ct.ahsl.lightness == 0 || ct.ahsl.lightness == 0
|| color.ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0