OSDN Git Service

use static RGB colors in QX11PixmapData::fromImage() and QColorDialog::customColor()
authorIvailo Monev <xakepa10@gmail.com>
Thu, 16 Sep 2021 11:04:27 +0000 (14:04 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Thu, 16 Sep 2021 11:04:27 +0000 (14:04 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/gui/dialogs/qcolordialog.cpp
src/gui/image/qpixmap_x11.cpp

index dd09f73..8639a75 100644 (file)
@@ -44,6 +44,7 @@
 #include "qdialogbuttonbox.h"
 #include "qguiplatformplugin.h"
 #include "qcoreapplication_p.h"
+#include "qguicommon_p.h"
 
 QT_BEGIN_NAMESPACE
 
@@ -399,7 +400,7 @@ int QColorDialog::customCount()
 QRgb QColorDialog::customColor(int index)
 {
     if (index >= customCount())
-        return qRgb(255, 255, 255);
+        return qt_whitergb;
     initRGB();
     return cusrgb[index];
 }
index bf33565..e130140 100644 (file)
@@ -327,7 +327,7 @@ void QX11PixmapData::fromImage(const QImage &img,
             if (image.colorCount() == 2) {
                 QRgb c0 = image.color(0);        // Auto: convert to best
                 QRgb c1 = image.color(1);
-                conv8 = qMin(c0,c1) != qRgb(0,0,0) || qMax(c0,c1) != qRgb(255,255,255);
+                conv8 = qMin(c0,c1) != qt_blackrgb || qMax(c0,c1) != qt_whitergb;
             } else {
                 // eg. 1-color monochrome images (they do exist).
                 conv8 = true;