summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglframebufferobject.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-02 14:23:08 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-02 16:59:55 +0200
commitd0eaa737e10aed34c09ba753e21c3e027b5ce58c (patch)
treece2a9ea9dbfbabf5cfc390feaed5ee94beb0449a /src/gui/opengl/qopenglframebufferobject.cpp
parent7c0b9e1e8d069afab997efd3df9632d342b23150 (diff)
parenta5f470240f31d35e694a40fe837fc4f49bc32072 (diff)
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
Diffstat (limited to 'src/gui/opengl/qopenglframebufferobject.cpp')
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 0e162713ce..e0ef7c52a5 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -43,6 +43,7 @@
#include <qwindow.h>
#include <qlibrary.h>
#include <qimage.h>
+#include <QtCore/qbytearray.h>
QT_BEGIN_NAMESPACE
@@ -1275,9 +1276,19 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
// Without GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA only makes sense on little endian.
- const bool supports_bgra = context->isOpenGLES()
- ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
- : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+ const bool has_bgra_ext = context->isOpenGLES()
+ ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
+ : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+
+ const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
+ const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
+
+ // Blacklist PowerVR Rogue G6200 as it has problems with its BGRA support.
+ const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
+ && ::strstr(ver, "1.3") != 0);
+
+ const bool supports_bgra = has_bgra_ext && !blackListed;
+
if (supports_bgra) {
QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, img.bits());