From 63aac71dc53496c8e501f84b0bb8af5f643f5bff Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 10 Jul 2020 01:32:43 +0000 Subject: [PATCH] avoid color masking/unmasking in init_gray() function Signed-off-by: Ivailo Monev --- src/gui/painting/qcolormap_x11.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qcolormap_x11.cpp b/src/gui/painting/qcolormap_x11.cpp index 43b14950a..d8c8b9678 100644 --- a/src/gui/painting/qcolormap_x11.cpp +++ b/src/gui/painting/qcolormap_x11.cpp @@ -235,15 +235,14 @@ static void init_gray(QColormapPrivate *d, int screen) for (int g = 0; g < d->g_max; ++g) { const int gray = (g * 0xff + (d->r_max - 1) / 2) / (d->r_max - 1); - const QRgb rgb = qRgb(gray, gray, gray); d->pixels[g] = -1; if (d->visual->c_class & 1) { XColor xcolor; - xcolor.red = qRed(rgb) * 0x101; - xcolor.green = qGreen(rgb) * 0x101; - xcolor.blue = qBlue(rgb) * 0x101; + xcolor.red = gray * 0x101; + xcolor.green = gray * 0x101; + xcolor.blue = gray * 0x101; xcolor.pixel = 0ul; if (XAllocColor(QX11Info::display(), d->colormap, &xcolor)) -- 2.11.0