diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2015-01-19 18:06:07 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-01-26 14:55:41 +0100 |
commit | 15ffff51b5cc92eb875785bbd16b6385638fe5dd (patch) | |
tree | bda3fff6ed65a24b840a35d14ee4f2a15cab839c /src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | |
parent | 47c089d15f79cd678e0c9de5c7fb5b5e2488a9f5 (diff) |
Avoid sRGB usage when targeting an incapable FBO
Native text rendering results in very different output on OS X
with QQuickWidget/QOpenGLWidget. When targeting an FBO, enabling
sRGB is futile if the FBO was not created with the correct format.
In this case we need to disable the usage of sRGB.
Task-number: QTBUG-42861
Change-Id: I887482e70be2cbfba40d6758546128d03b36def1
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/quick/scenegraph/qsgdefaultglyphnode_p.cpp')
-rw-r--r-- | src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 5cca474ea1..9263d5676f 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -53,6 +53,10 @@ QT_BEGIN_NAMESPACE #define GL_FRAMEBUFFER_SRGB 0x8DB9 #endif +#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE +#define GL_FRAMEBUFFER_SRGB_CAPABLE 0x8DBA +#endif + static inline QVector4D qsg_premultiply(const QVector4D &c, float globalOpacity) { float o = c.w() * globalOpacity; @@ -199,7 +203,11 @@ void QSG24BitTextMaskShader::initialize() if (QOpenGLContext::currentContext()->hasExtension(QByteArrayLiteral("GL_ARB_framebuffer_sRGB")) && m_glyphFormat == QFontEngine::Format_A32 && qAbs(fontSmoothingGamma() - 2.2) < 0.25) { - m_useSRGB = true; + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); + GLint srgbCapable = 0; + funcs->glGetIntegerv(GL_FRAMEBUFFER_SRGB_CAPABLE, &srgbCapable); + if (srgbCapable) + m_useSRGB = true; } } |