summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-04-29 09:57:32 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2009-04-29 09:59:54 (GMT)
commitd07de7568cdfb1889e4b64fcbe3fcbfa120ae264 (patch)
tree9b054c079ecc4065dd910407a4c27fc74a94170b /src/opengl
parente9af6b7befd099c71acabe32b3da0f7b0e93446c (diff)
downloadQt-d07de7568cdfb1889e4b64fcbe3fcbfa120ae264.zip
Qt-d07de7568cdfb1889e4b64fcbe3fcbfa120ae264.tar.gz
Qt-d07de7568cdfb1889e4b64fcbe3fcbfa120ae264.tar.bz2
Get rid of an unnecessary image copy when grabbing a GL framebuffer.
Task-number: Related to 241466 Reviewed-by: Samuel
Diffstat (limited to 'src/opengl')
-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 8ffee87..04bc611 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1327,13 +1327,21 @@ QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include
// This is an old legacy fix for PowerPC based Macs, which
// we shouldn't remove
while (p < end) {
- *p = 0xFF000000 | (*p>>8);
+ *p = 0xff000000 | (*p>>8);
++p;
}
}
} else {
// OpenGL gives ABGR (i.e. RGBA backwards); Qt wants ARGB
- img = img.rgbSwapped();
+ for (int y = 0; y < h; y++) {
+ 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);
+ q++;
+ }
+ }
+
}
return img.mirrored();
}