From 455d58e2cdc6833e389ab27dd028cc236dd5259b Mon Sep 17 00:00:00 2001 From: Morten Sorvig Date: Wed, 29 Jun 2011 12:33:05 +0200 Subject: 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. --- .../readback_cgl/qwaylandreadbackcglcontext.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/plugins/platforms/wayland') 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 #include +#include #include @@ -87,26 +88,15 @@ void QWaylandReadbackCGLContext::swapBuffers(QPlatformSurface *surface) CGLFlushDrawable(m_glContext); QWaylandReadbackCGLWindow *window = static_cast(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(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(constDstBits); - memcpy(dstBits,constBits,(img.width()*4) * img.height()); + uchar *dstBits = const_cast(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)) () -- cgit v1.2.3