summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-14 17:30:59 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-09-15 01:41:13 +0200
commit9815ebf24b5aa148a416ee3b159088f0092d2715 (patch)
treeb86cf5ddb2ddebe72d6f4ae5040e77342fa459e7 /src/gui/opengl
parentfce84f76f04957e51f1d92129236733d9bf7d08a (diff)
Switch QSurfaceFormat::colorSpace to a QColorSpace
Allows more flexibility in the future. Change-Id: Idcf2d8ddaee268a7b5d55379ccb42dd9b3c33abf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r--src/gui/opengl/platform/unix/qglxconvenience.cpp23
1 files changed, 15 insertions, 8 deletions
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 <QtCore/qbytearray.h>
-#include <QtCore/qscopedpointer.h>
-
#include <QtCore/qmetatype.h>
+#include <QtCore/qscopedpointer.h>
#include <QtCore/qtextstream.h>
+#include <QtGui/qcolorspace.h>
#include "qglxconvenience_p.h"
#include <QtCore/qloggingcategory.h>
#include <QtCore/qvarlengtharray.h>
+
#include <GL/glxext.h>
enum {
@@ -126,7 +127,7 @@ QList<int> 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;
}