diff options
Diffstat (limited to 'src/plugins/platforms/wayland/gl_integration/readback_cgl')
7 files changed, 0 insertions, 517 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 deleted file mode 100644 index 5f7663ef55..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackcglcontext.h" - -#include "qwaylandshmbackingstore.h" -#include "qwaylandreadbackcglwindow.h" - -#include <QtGui/QOpenGLContext> -#include <QtCore/QDebug> - -#include <OpenGL/OpenGL.h> -#include <OpenGL/glext.h> -#include <OpenGL/glu.h> - -#include <QtPlatformSupport/private/cglconvenience_p.h> - -QWaylandReadbackCGLContext::QWaylandReadbackCGLContext(QPlatformOpenGLContext *share) - : QPlatformOpenGLContext() -{ - Q_UNUSED(share); - m_glContext = qcgl_createGlContext(); -} - -QSurfaceFormat QWaylandReadbackCGLContext::format() const -{ - return qcgl_surfaceFormat(); -} - -bool QWaylandReadbackCGLContext::makeCurrent(QPlatformSurface *surface) -{ - QWaylandReadbackCGLWindow *window = static_cast<QWaylandReadbackCGLWindow *>(surface); - CGLSetPBuffer(m_glContext, window->pixelBuffer(), 0, 0, 0); - CGLSetCurrentContext(m_glContext); - return true; -} - -void QWaylandReadbackCGLContext::doneCurrent() -{ - CGLSetCurrentContext(0); -} - -void QWaylandReadbackCGLContext::swapBuffers(QPlatformSurface *surface) -{ - Q_UNUSED(surface); - - if (QOpenGLContext::currentContext()->handle() != this) { - makeCurrent(surface); - } - CGLFlushDrawable(m_glContext); - - QWaylandReadbackCGLWindow *window = static_cast<QWaylandReadbackCGLWindow *>(surface); - QSize size = window->geometry().size(); - - 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)); - - // ### Should sync here but this call deadlocks with the server. - //window->waitForFrameSync(); -} - -void (*QWaylandReadbackCGLContext::getProcAddress(const QByteArray &procName)) () -{ - return qcgl_getProcAddress(procName); -} - diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h deleted file mode 100644 index eb065c3f69..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglcontext.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKCGLCONTEXT_H -#define QWAYLANDREADBACKCGLCONTEXT_H - -#include <QPlatformOpenGLContext> - -#include "qwaylandreadbackcglintegration.h" - -#include <OpenGL/OpenGL.h> - -class QWaylandReadbackCGLWindow; -class QWaylandShmBuffer; - -class QWaylandReadbackCGLContext : public QPlatformOpenGLContext -{ -public: - QWaylandReadbackCGLContext(QPlatformOpenGLContext *share); - - QSurfaceFormat format() const; - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - void swapBuffers(QPlatformSurface *surface); - void (*getProcAddress(const QByteArray &procName)) (); - - void geometryChanged(); - -private: - CGLContextObj m_glContext; -}; - -#endif // QWAYLANDREADBACKCGLCONTEXT_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp deleted file mode 100644 index 2878f9e292..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackcglintegration.h" -#include "qwaylandreadbackcglcontext.h" -#include "qwaylandreadbackcglwindow.h" - -#include <QtCore/QDebug> - -QWaylandGLIntegration * QWaylandGLIntegration::createGLIntegration(QWaylandDisplay *waylandDisplay) -{ - return new QWaylandReadbackCGLIntegration(waylandDisplay); -} - -QWaylandReadbackCGLIntegration::QWaylandReadbackCGLIntegration(QWaylandDisplay * waylandDispaly) - : QWaylandGLIntegration() - , mWaylandDisplay(waylandDispaly) -{ - qDebug() << "Using Readback-CGL"; -} - -QWaylandReadbackCGLIntegration::~QWaylandReadbackCGLIntegration() -{ - -} - -void QWaylandReadbackCGLIntegration::initialize() -{ -} - -QWaylandWindow * QWaylandReadbackCGLIntegration::createEglWindow(QWindow *window) -{ - return new QWaylandReadbackCGLWindow(window,this); -} - -QPlatformOpenGLContext *QWaylandReadbackCGLIntegration::createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const -{ - return new QWaylandReadbackCGLContext(share); -} - -QWaylandDisplay * QWaylandReadbackCGLIntegration::waylandDisplay() const -{ - return mWaylandDisplay; -} diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h deleted file mode 100644 index 34c8d00a7c..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglintegration.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKGLXINTEGRATION_H -#define QWAYLANDREADBACKGLXINTEGRATION_H - -#include "gl_integration/qwaylandglintegration.h" - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> -#include <QtGui/QWindow> - -#include <X11/Xlib.h> - -class QWaylandReadbackCGLIntegration : public QWaylandGLIntegration -{ -public: - QWaylandReadbackCGLIntegration(QWaylandDisplay * waylandDispaly); - ~QWaylandReadbackCGLIntegration(); - - void initialize(); - - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; - QWaylandDisplay *waylandDisplay() const; - -private: - QWaylandDisplay *mWaylandDisplay; -}; - -#endif // QWAYLANDREADBACKGLXINTEGRATION_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp deleted file mode 100644 index 9e7f8520c9..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwaylandreadbackcglwindow.h" -#include "qwaylandshmbackingstore.h" - -#include <OpenGL/OpenGL.h> -#include <OpenGL/glext.h> - -QWaylandReadbackCGLWindow::QWaylandReadbackCGLWindow(QWindow *window, QWaylandReadbackCGLIntegration *cglIntegration) - : QWaylandShmWindow(window) - , m_CglIntegration(cglIntegration) - , mContext(0) - , m_buffer(0) - , m_pixelBuffer(0) -{ -} - -QWaylandWindow::WindowType QWaylandReadbackCGLWindow::windowType() const -{ - //yeah. this type needs a new name - return QWaylandWindow::Egl; -} - - -void QWaylandReadbackCGLWindow::setGeometry(const QRect &rect) -{ - QWaylandShmWindow::setGeometry(rect); - - if (m_buffer) { - delete m_buffer; - m_buffer = 0; - - CGLDestroyPBuffer(m_pixelBuffer); - m_pixelBuffer = 0; - } -} - -CGLPBufferObj QWaylandReadbackCGLWindow::pixelBuffer() -{ - if (!m_pixelBuffer) - createSurface(); - - return m_pixelBuffer; -} - -uchar *QWaylandReadbackCGLWindow::buffer() -{ - return m_buffer->image()->bits(); -} - -void QWaylandReadbackCGLWindow::createSurface() -{ - QSize size(geometry().size()); - if (size.isEmpty()) { - //QGLWidget wants a context for a window without geometry - size = QSize(1,1); - } - - waitForFrameSync(); - - CGLCreatePBuffer(size.width(), size.height(), GL_TEXTURE_RECTANGLE_ARB, GL_BGRA, 0, &m_pixelBuffer); - - delete m_buffer; - m_buffer = new QWaylandShmBuffer(m_CglIntegration->waylandDisplay(),size,QImage::Format_ARGB32); - attach(m_buffer); -} - diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h b/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h deleted file mode 100644 index 0598cf9037..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/qwaylandreadbackcglwindow.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAYLANDREADBACKGLXWINDOW_H -#define QWAYLANDREADBACKGLXWINDOW_H - -#include "qwaylandshmwindow.h" -#include "qwaylandreadbackcglintegration.h" -#include "qwaylandreadbackcglcontext.h" - -#include <OpenGL/OpenGL.h> - -class QWaylandReadbackCGLWindow : public QWaylandShmWindow -{ -public: - QWaylandReadbackCGLWindow(QWindow *window, QWaylandReadbackCGLIntegration *cglIntegration); - WindowType windowType() const; - - void setGeometry(const QRect &rect); - CGLPBufferObj pixelBuffer(); - uchar *buffer(); -private: - void createSurface(); - - QWaylandReadbackCGLIntegration *m_CglIntegration; - QWaylandReadbackCGLContext *mContext; - - QWaylandShmBuffer *m_buffer; - CGLPBufferObj m_pixelBuffer; -}; - -#endif // QWAYLANDREADBACKGLXWINDOW_H diff --git a/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri b/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri deleted file mode 100644 index 91cb90a30c..0000000000 --- a/src/plugins/platforms/wayland/gl_integration/readback_cgl/readback_cgl.pri +++ /dev/null @@ -1,10 +0,0 @@ -HEADERS += \ - $$PWD/qwaylandreadbackcglintegration.h \ - $$PWD/qwaylandreadbackcglwindow.h \ - $$PWD/qwaylandreadbackcglcontext.h - -SOURCES += \ - $$PWD/qwaylandreadbackcglintegration.cpp \ - $$PWD/qwaylandreadbackcglwindow.cpp \ - $$PWD/qwaylandreadbackcglcontext.cpp - |