From 9815ebf24b5aa148a416ee3b159088f0092d2715 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 14 Sep 2020 17:30:59 +0200 Subject: Switch QSurfaceFormat::colorSpace to a QColorSpace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows more flexibility in the future. Change-Id: Idcf2d8ddaee268a7b5d55379ccb42dd9b3c33abf Reviewed-by: Tor Arne Vestbø --- src/gui/opengl/platform/unix/qglxconvenience.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/gui/opengl') diff --git a/src/gui/opengl/platform/unix/qglxconvenience.cpp b/src/gui/opengl/platform/unix/qglxconvenience.cpp index 94781aac3d..fd6f1639a3 100644 --- a/src/gui/opengl/platform/unix/qglxconvenience.cpp +++ b/src/gui/opengl/platform/unix/qglxconvenience.cpp @@ -40,15 +40,16 @@ // We have to include this before the X11 headers dragged in by // qglxconvenience_p.h. #include -#include - #include +#include #include +#include #include "qglxconvenience_p.h" #include #include + #include enum { @@ -126,7 +127,7 @@ QList qglx_buildSpec(const QSurfaceFormat &format, int drawableBit, int fla << GLX_SAMPLES_ARB << format.samples(); - if ((flags & QGLX_SUPPORTS_SRGB) && format.colorSpace() == QSurfaceFormat::sRGBColorSpace) + if ((flags & QGLX_SUPPORTS_SRGB) && format.colorSpace() == QColorSpace::SRgb) spec << GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB << True; @@ -217,7 +218,7 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , QSurfaceFormat format for (int i = 0; i < confcount; i++) { GLXFBConfig candidate = configs[i]; - if ((flags & QGLX_SUPPORTS_SRGB) && format.colorSpace() == QSurfaceFormat::sRGBColorSpace) { + if ((flags & QGLX_SUPPORTS_SRGB) && format.colorSpace() == QColorSpace::SRgb) { int srgbCapable = 0; glXGetFBConfigAttrib(display, candidate, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB, &srgbCapable); if (!srgbCapable) @@ -335,7 +336,10 @@ void qglx_surfaceFormatFromGLXFBConfig(QSurfaceFormat *format, Display *display, glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); format->setSamples(sampleCount); } - format->setColorSpace(srgbCapable ? QSurfaceFormat::sRGBColorSpace : QSurfaceFormat::DefaultColorSpace); + if (srgbCapable) + format->setColorSpace(QColorSpace::SRgb); + else + format->setColorSpace(QColorSpace()); format->setStereo(stereo); } @@ -374,7 +378,10 @@ void qglx_surfaceFormatFromVisualInfo(QSurfaceFormat *format, Display *display, glXGetConfig(display, visualInfo, GLX_SAMPLES_ARB, &sampleCount); format->setSamples(sampleCount); } - format->setColorSpace(srgbCapable ? QSurfaceFormat::sRGBColorSpace : QSurfaceFormat::DefaultColorSpace); + if (srgbCapable) + format->setColorSpace(QColorSpace::SRgb); + else + format->setColorSpace(QColorSpace()); format->setStereo(stereo); } @@ -455,8 +462,8 @@ bool qglx_reduceFormat(QSurfaceFormat *format) return true; } - if (format->colorSpace() == QSurfaceFormat::sRGBColorSpace) { - format->setColorSpace(QSurfaceFormat::DefaultColorSpace); + if (format->colorSpace() == QColorSpace::SRgb) { + format->setColorSpace(QColorSpace()); return true; } -- cgit v1.2.3