summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-27 08:42:37 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-27 08:42:37 (GMT)
commit1f640fa57d6136f25b34d3ccf7994af62177da4c (patch)
tree1707dc0f6dc8c21e060900e4549eaa5447de5ec7
parent8483ebbfd0753cd9c02b0682fdbeb636e273de87 (diff)
parent1113ec294d0f92f4961d3f102ef7a702a765cfe3 (diff)
downloadQt-1f640fa57d6136f25b34d3ccf7994af62177da4c.zip
Qt-1f640fa57d6136f25b34d3ccf7994af62177da4c.tar.gz
Qt-1f640fa57d6136f25b34d3ccf7994af62177da4c.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixed QGLWidget::grabFrameBuffer() to honor the 'withAlpha' value.
-rw-r--r--src/opengl/qgl.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index ca898c7..c294e4f 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1534,7 +1534,14 @@ static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, boo
uint *q = (uint*)img.scanLine(y);
for (int x=0; x < w; ++x) {
const uint pixel = *q;
- *q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) | (pixel & 0xff00ff00);
+ if (alpha_format && include_alpha) {
+ *q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff)
+ | (pixel & 0xff00ff00);
+ } else {
+ *q = 0xff000000 | ((pixel << 16) & 0xff0000)
+ | ((pixel >> 16) & 0xff) | (pixel & 0x00ff00);
+ }
+
q++;
}
}
@@ -1545,7 +1552,8 @@ static void convertFromGLImage(QImage &img, int w, int h, bool alpha_format, boo
QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha)
{
- QImage img(size, alpha_format ? QImage::Format_ARGB32 : QImage::Format_RGB32);
+ QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32
+ : QImage::Format_RGB32);
int w = size.width();
int h = size.height();
glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, img.bits());