summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wayland
diff options
context:
space:
mode:
authorMorten Sorvig <morten.sorvig@nokia.com>2011-06-29 12:33:05 +0200
committerMorten Sorvig <morten.sorvig@nokia.com>2011-07-01 09:39:52 +0200
commit455d58e2cdc6833e389ab27dd028cc236dd5259b (patch)
tree840fa248fffda828de4666652fe46d5b27f92a8c /src/plugins/platforms/wayland
parentee6f25f1fecc375fa6eb10c38e1b074345f898b1 (diff)
Clean up wayland-cgl-readback.
Read directly into the window buffer - looks like we don't need to do any byte swapping. Disable the frame sync, since this causes a deadlock with the compositor.
Diffstat (limited to 'src/plugins/platforms/wayland')
-rw-r--r--src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp
index 7f21f2ebcc..d0712a3989 100644
--- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp
@@ -49,6 +49,7 @@
#include <OpenGL/OpenGL.h>
#include <OpenGL/glext.h>
+#include <OpenGL/glu.h>
#include <QtPlatformSupport/private/cglconvenience_p.h>
@@ -87,26 +88,15 @@ void QWaylandReadbackCGLContext::swapBuffers(QPlatformSurface *surface)
CGLFlushDrawable(m_glContext);
QWaylandReadbackCGLWindow *window = static_cast<QWaylandReadbackCGLWindow *>(surface);
-
QSize size = window->geometry().size();
- QImage img(size,QImage::Format_ARGB32);
- img.fill(Qt::red);
- const uchar *constBits = img.bits();
- void *pixels = const_cast<uchar *>(constBits);
-
-// glReadPixels(0,0, size.width(), size.height(), GL_RGBA,GL_UNSIGNED_BYTE, pixels);
-// img = img.mirrored();
-// qgl_byteSwapImage(img,GL_UNSIGNED_INT_8_8_8_8_REV);
-
- constBits = img.bits();
-
- const uchar *constDstBits = window->buffer();
- uchar *dstBits = const_cast<uchar *>(constDstBits);
- memcpy(dstBits,constBits,(img.width()*4) * img.height());
+ uchar *dstBits = const_cast<uchar *>(window->buffer());
+ glReadPixels(0,0, size.width(), size.height(), GL_BGRA,GL_UNSIGNED_BYTE, dstBits);
window->damage(QRect(QPoint(0,0),size));
- window->waitForFrameSync();
+
+ // ### Should sync here but this call deadlocks with the server.
+ //window->waitForFrameSync();
}
void (*QWaylandReadbackCGLContext::getProcAddress(const QByteArray &procName)) ()