diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/opengl.pro | 21 | ||||
-rw-r--r-- | src/opengl/qgl_qws.cpp | 318 | ||||
-rw-r--r-- | src/opengl/qglscreen_qws.cpp | 242 | ||||
-rw-r--r-- | src/opengl/qglscreen_qws.h | 127 | ||||
-rw-r--r-- | src/opengl/qglwindowsurface_qws.cpp | 133 | ||||
-rw-r--r-- | src/opengl/qglwindowsurface_qws_p.h | 90 |
6 files changed, 1 insertions, 930 deletions
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index e7c1c446de..c490781251 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -11,7 +11,7 @@ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui include(../qbase.pri) -!win32:!embedded:!mac:!symbian:!qpa:CONFIG += x11 +!win32:!mac:!symbian:!qpa:CONFIG += x11 contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles1):CONFIG += opengles1 contains(QT_CONFIG, opengles2):CONFIG += opengles2 @@ -105,7 +105,6 @@ x11 { contains(QT_CONFIG, fontconfig) { contains(QT_CONFIG, system-freetype) { - embedded:CONFIG += opentype # pull in the proper freetype2 include directory include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) LIBS_PRIVATE += -lfreetype @@ -138,24 +137,6 @@ wince*: { HEADERS += qgl_egl_p.h } -embedded { - SOURCES += qgl_qws.cpp \ - qglpixelbuffer_egl.cpp \ - qglscreen_qws.cpp \ - qglwindowsurface_qws.cpp \ - qgl_egl.cpp - - HEADERS += qglscreen_qws.h \ - qglwindowsurface_qws_p.h \ - qgl_egl_p.h - - contains(QT_CONFIG, fontconfig) { - include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) - } else { - DEFINES *= QT_NO_FREETYPE - } -} - symbian { DEFINES += QGL_USE_TEXTURE_POOL QGL_NO_PRESERVED_SWAP SOURCES -= qpixmapdata_gl.cpp diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp deleted file mode 100644 index 6ad2774eaf..0000000000 --- a/src/opengl/qgl_qws.cpp +++ /dev/null @@ -1,318 +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 QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qgl.h" -#include "qgl_egl_p.h" -#include "qglpixelbuffer.h" - -#include <qglscreen_qws.h> -#include <qscreenproxy_qws.h> -#include <private/qglwindowsurface_qws_p.h> - -#include <private/qbackingstore_p.h> -#include <private/qfont_p.h> -#include <private/qfontengine_p.h> -#include <private/qgl_p.h> -#include <private/qpaintengine_opengl_p.h> -#include <qpixmap.h> -#include <qtimer.h> -#include <qapplication.h> -#include <qstack.h> -#include <qdesktopwidget.h> -#include <qdebug.h> -#include <qvarlengtharray.h> - -QT_BEGIN_NAMESPACE - -static QGLScreen *glScreenForDevice(QPaintDevice *device) -{ - QScreen *screen = qt_screen; - if (screen->classId() == QScreen::MultiClass) { - int screenNumber; - if (device && device->devType() == QInternal::Widget) - screenNumber = qApp->desktop()->screenNumber(static_cast<QWidget *>(device)); - else - screenNumber = 0; - screen = screen->subScreens()[screenNumber]; - } - while (screen->classId() == QScreen::ProxyClass || - screen->classId() == QScreen::TransformedClass) { - screen = static_cast<QProxyScreen *>(screen)->screen(); - } - if (screen->classId() == QScreen::GLClass) - return static_cast<QGLScreen *>(screen); - else - return 0; -} - -/* - QGLTemporaryContext implementation -*/ - -class QGLTemporaryContextPrivate -{ -public: - QGLWidget *widget; -}; - -QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) - : d(new QGLTemporaryContextPrivate) -{ - d->widget = new QGLWidget; - d->widget->makeCurrent(); -} - -QGLTemporaryContext::~QGLTemporaryContext() -{ - delete d->widget; -} - -/***************************************************************************** - QOpenGL debug facilities - *****************************************************************************/ -//#define DEBUG_OPENGL_REGION_UPDATE - -bool QGLFormat::hasOpenGLOverlays() -{ - QGLScreen *glScreen = glScreenForDevice(0); - if (glScreen) - return (glScreen->options() & QGLScreen::Overlays); - else - return false; -} - -static EGLSurface qt_egl_create_surface - (QEglContext *context, QPaintDevice *device, - const QEglProperties *properties = 0) -{ - // Get the screen surface functions, which are used to create native ids. - QGLScreen *glScreen = glScreenForDevice(device); - if (!glScreen) - return EGL_NO_SURFACE; - QGLScreenSurfaceFunctions *funcs = glScreen->surfaceFunctions(); - if (!funcs) - return EGL_NO_SURFACE; - - // Create the native drawable for the paint device. - int devType = device->devType(); - EGLNativePixmapType pixmapDrawable = 0; - EGLNativeWindowType windowDrawable = 0; - bool ok; - if (devType == QInternal::Pixmap) { - ok = funcs->createNativePixmap(static_cast<QPixmap *>(device), &pixmapDrawable); - } else if (devType == QInternal::Image) { - ok = funcs->createNativeImage(static_cast<QImage *>(device), &pixmapDrawable); - } else { - ok = funcs->createNativeWindow(static_cast<QWidget *>(device), &windowDrawable); - } - if (!ok) { - qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable"); - return EGL_NO_SURFACE; - } - - // Create the EGL surface to draw into, based on the native drawable. - const int *props; - if (properties) - props = properties->properties(); - else - props = 0; - EGLSurface surf; - if (devType == QInternal::Widget) { - surf = eglCreateWindowSurface - (context->display(), context->config(), windowDrawable, props); - } else { - surf = eglCreatePixmapSurface - (context->display(), context->config(), pixmapDrawable, props); - } - if (surf == EGL_NO_SURFACE) - qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); - return surf; -} - -bool QGLContext::chooseContext(const QGLContext* shareContext) -{ - Q_D(QGLContext); - - // Validate the device. - if (!device()) - return false; - int devType = device()->devType(); - if (devType != QInternal::Pixmap && devType != QInternal::Image && devType != QInternal::Widget) { - qWarning("QGLContext::chooseContext(): Cannot create QGLContext's for paint device type %d", devType); - return false; - } - - // Get the display and initialize it. - d->eglContext = new QEglContext(); - d->ownsEglContext = true; - d->eglContext->setApi(QEgl::OpenGL); - - // Construct the configuration we need for this surface. - QEglProperties configProps; - qt_eglproperties_set_glformat(configProps, d->glFormat); - configProps.setDeviceType(devType); - configProps.setPaintDeviceFormat(device()); - configProps.setRenderableType(QEgl::OpenGL); - - // Search for a matching configuration, reducing the complexity - // each time until we get something that matches. - if (!d->eglContext->chooseConfig(configProps)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - - // Inform the higher layers about the actual format properties. - qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); - - // Create a new context for the configuration. - if (!d->eglContext->createContext - (shareContext ? shareContext->d_func()->eglContext : 0)) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - d->sharing = d->eglContext->isSharing(); - if (d->sharing && shareContext) - const_cast<QGLContext *>(shareContext)->d_func()->sharing = true; - -#if defined(EGL_VERSION_1_1) - if (d->glFormat.swapInterval() != -1 && devType == QInternal::Widget) - eglSwapInterval(d->eglContext->display(), d->glFormat.swapInterval()); -#endif - - // Create the EGL surface to draw into. We cannot use - // QEglContext::createSurface() because it does not have - // access to the QGLScreen. - d->eglSurface = qt_egl_create_surface(d->eglContext, device()); - if (d->eglSurface == EGL_NO_SURFACE) { - delete d->eglContext; - d->eglContext = 0; - return false; - } - - return true; -} - - -bool QGLWidget::event(QEvent *e) -{ - return QWidget::event(e); -} - - -void QGLWidget::resizeEvent(QResizeEvent *) -{ - Q_D(QGLWidget); - if (!isValid()) - return; - makeCurrent(); - if (!d->glcx->initialized()) - glInit(); - resizeGL(width(), height()); - //handle overlay -} - -const QGLContext* QGLWidget::overlayContext() const -{ - return 0; -} - -void QGLWidget::makeOverlayCurrent() -{ - //handle overlay -} - -void QGLWidget::updateOverlayGL() -{ - //handle overlay -} - -void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, bool deleteOldContext) -{ - Q_D(QGLWidget); - if(context == 0) { - qWarning("QGLWidget::setContext: Cannot set null context"); - return; - } - - if(d->glcx) - d->glcx->doneCurrent(); - QGLContext* oldcx = d->glcx; - d->glcx = context; - if(!d->glcx->isValid()) - d->glcx->create(shareContext ? shareContext : oldcx); - if(deleteOldContext) - delete oldcx; -} - -void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget* shareWidget) -{ - Q_Q(QGLWidget); - - QGLScreen *glScreen = glScreenForDevice(q); - if (glScreen) { - wsurf = static_cast<QWSGLWindowSurface*>(glScreen->createSurface(q)); - q->setWindowSurface(wsurf); - } - - initContext(context, shareWidget); - - if(q->isValid() && glcx->format().hasOverlay()) { - //no overlay - qWarning("QtOpenGL ES doesn't currently support overlays"); - } -} - -void QGLWidgetPrivate::cleanupColormaps() -{ -} - -const QGLColormap & QGLWidget::colormap() const -{ - return d_func()->cmap; -} - -void QGLWidget::setColormap(const QGLColormap &) -{ -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglscreen_qws.cpp b/src/opengl/qglscreen_qws.cpp deleted file mode 100644 index badb581844..0000000000 --- a/src/opengl/qglscreen_qws.cpp +++ /dev/null @@ -1,242 +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 QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QGLScreen> -#include <QGLContext> -#include <QGLWidget> -#include "private/qglwindowsurface_qws_p.h" - -QT_BEGIN_NAMESPACE - -class QGLScreenPrivate -{ -public: - QGLScreen::Options options; - QGLScreenSurfaceFunctions *functions; -}; - -/*! - \internal - \preliminary - \class QGLScreen - - \brief This class encapsulates an OpenGL screen driver. -*/ - -QGLScreen::QGLScreen(int displayId) - : QScreen(displayId, GLClass), d_ptr(new QGLScreenPrivate) -{ - d_ptr->options = NoOptions; - d_ptr->functions = new QGLScreenSurfaceFunctions(); -} - -QGLScreen::~QGLScreen() -{ - delete d_ptr->functions; - delete d_ptr; -} - -/*! - \since 4.3 - \obsolete - - Initializes the \a context and sets up the QGLWindowSurface of the - QWidget of \a context based on the parameters of \a context and - based on its own requirements. The format() of \a context needs - to be updated with the actual parameters of the OpenGLES drawable - that was set up. - - \a shareContext is used in the same way as for QGLContext. It is - the context with which \a context shares display lists and texture - ids etc. The window surface must be set up so that this sharing - works. - - Returns true in case of success and false if it is not possible to - create the necessary OpenGLES drawable/context. - - Since 4.4.2, this function will be not be called if options() - indicates that a native window or pixmap drawable can be created - via the functions in the surfaceFunctions() object. - - This function is obsolete in Qt 4.5 and higher. Use surfaceFunctions() - instead. - - \sa options(), surfaceFunctions() -*/ -bool -QGLScreen::chooseContext(QGLContext *context, const QGLContext *shareContext) -{ - Q_UNUSED(context); - Q_UNUSED(shareContext); - return false; -} - -/*! - \enum QGLScreen::Option - This enum defines options that can be set on QGLScreen instances. - - \value NoOptions There are no special options on the screen. This is the default. - \value NativeWindows Native windows can be created with QGLScreenSurfaceFunctions::createNativeWindow(). - \value NativePixmaps Native pixmaps can be created with QGLScreenSurfaceFunctions::createNativePixmap(). - \value NativeImages Native images can be created with QGLScreenSurfaceFunctions::createNativeImage(). - \value Overlays The screen supports GL overlays. -*/ - -/*! - \since 4.4.2 - - Returns the options associated with this QGLScreen. - - \sa setOptions() -*/ -QGLScreen::Options QGLScreen::options() const -{ - return d_ptr->options; -} - -/*! - \since 4.4.2 - - Sets the options associated with this QGLScreen to \a value. - - \sa options() -*/ -void QGLScreen::setOptions(QGLScreen::Options value) -{ - d_ptr->options = value; -} - -/*! - \since 4.4.2 - - Returns the surface functions object for this QGLScreen. - - \sa setSurfaceFunctions() -*/ -QGLScreenSurfaceFunctions *QGLScreen::surfaceFunctions() const -{ - return d_ptr->functions; -} - -/*! - \since 4.4.2 - - Sets the surface functions object for this QGLScreen to \a functions. - The QGLScreen will take over ownership of \a functions and delete - it when the QGLScreen is deleted. - - \sa setSurfaceFunctions() -*/ -void QGLScreen::setSurfaceFunctions(QGLScreenSurfaceFunctions *functions) -{ - if (functions && functions != d_ptr->functions) { - delete d_ptr->functions; - d_ptr->functions = functions; - } -} - -/*! - \internal - \preliminary - \class QGLScreenSurfaceFunctions - \brief The QGLScreenSurfaceFunctions class encapsulates the functions for creating native windows and pixmaps for OpenGL ES. -*/ - -/*! - \since 4.4.2 - - Creates a native OpenGLES drawable for the surface of \a widget and - returns it in \a native. Returns true if the OpenGLES drawable could - be created, or false if windows are not supported. - - This function will be called if the NativeWindows option is set on - the screen. - - \sa createNativePixmap(), createNativeImage(), QGLScreen::options() -*/ -bool QGLScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNativeWindowType *native) -{ - Q_UNUSED(widget); - Q_UNUSED(native); - return false; -} - -/*! - \since 4.4.2 - - Creates a native OpenGLES drawable for directly rendering into - \a pixmap and returns it in \a native. Returns true if the OpenGLES - drawable could be created, or false if direct rendering into pixmaps - is not supported. - - This function will be called if the NativePixmaps option is set on - the screen. - - \sa createNativeWindow(), createNativeImage(), QGLScreen::options() -*/ -bool QGLScreenSurfaceFunctions::createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native) -{ - Q_UNUSED(pixmap); - Q_UNUSED(native); - return false; -} - -/*! - \since 4.4.2 - - Creates a native OpenGLES drawable for directly rendering into - \a image and returns it in \a native. Returns true if the OpenGLES - drawable could be created, or false if direct rendering into images - is not supported. - - This function will be called if the NativeImages option is set on - the screen. - - \sa createNativeWindow(), createNativePixmap(), QGLScreen::options() -*/ -bool QGLScreenSurfaceFunctions::createNativeImage(QImage *image, EGLNativePixmapType *native) -{ - Q_UNUSED(image); - Q_UNUSED(native); - return false; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglscreen_qws.h b/src/opengl/qglscreen_qws.h deleted file mode 100644 index 1fefc1ce6e..0000000000 --- a/src/opengl/qglscreen_qws.h +++ /dev/null @@ -1,127 +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 QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSCREENEGL_P_H -#define QSCREENEGL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QScreenEGL class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include <QtGui/QScreen> -#include <QtOpenGL/qgl.h> -#if defined(QT_OPENGL_ES_2) -#include <EGL/egl.h> -#else -#include <GLES/egl.h> -#endif -#if !defined(EGL_VERSION_1_3) && !defined(QEGL_NATIVE_TYPES_DEFINED) -#undef EGLNativeWindowType -#undef EGLNativePixmapType -#undef EGLNativeDisplayType -typedef NativeWindowType EGLNativeWindowType; -typedef NativePixmapType EGLNativePixmapType; -typedef NativeDisplayType EGLNativeDisplayType; -#define QEGL_NATIVE_TYPES_DEFINED 1 -#endif - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(OpenGL) - -class QGLScreenPrivate; - -class Q_OPENGL_EXPORT QGLScreenSurfaceFunctions -{ -public: - virtual bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native); - virtual bool createNativePixmap(QPixmap *pixmap, EGLNativePixmapType *native); - virtual bool createNativeImage(QImage *image, EGLNativePixmapType *native); -}; - -class Q_OPENGL_EXPORT QGLScreen : public QScreen -{ - Q_DECLARE_PRIVATE(QGLScreen) -public: - QGLScreen(int displayId); - virtual ~QGLScreen(); - - enum Option - { - NoOptions = 0, - NativeWindows = 1, - NativePixmaps = 2, - NativeImages = 4, - Overlays = 8 - }; - Q_DECLARE_FLAGS(Options, Option) - - QGLScreen::Options options() const; - - virtual bool chooseContext(QGLContext *context, const QGLContext *shareContext); - virtual bool hasOpenGL() = 0; - - QGLScreenSurfaceFunctions *surfaceFunctions() const; - -protected: - void setOptions(QGLScreen::Options value); - void setSurfaceFunctions(QGLScreenSurfaceFunctions *functions); - -private: - QGLScreenPrivate *d_ptr; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS(QGLScreen::Options) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QSCREENEGL_P_H diff --git a/src/opengl/qglwindowsurface_qws.cpp b/src/opengl/qglwindowsurface_qws.cpp deleted file mode 100644 index 8d1d733d79..0000000000 --- a/src/opengl/qglwindowsurface_qws.cpp +++ /dev/null @@ -1,133 +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 QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtGui/QPaintDevice> -#include <QtGui/QWidget> -#include <QtOpenGL/QGLWidget> -#include "private/qglwindowsurface_qws_p.h" -#include "private/qpaintengine_opengl_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \class QWSGLWindowSurface - \since 4.3 - \ingroup qws - \preliminary - - \brief The QWSGLWindowSurface class provides the drawing area for top-level - windows with Qt for Embedded Linux on EGL/OpenGL ES. It also provides the - drawing area for \l{QGLWidget}s whether they are top-level windows or - children of another QWidget. - - Note that this class is only available in Qt for Embedded Linux and only - available if Qt is configured with OpenGL support. -*/ - -class QWSGLWindowSurfacePrivate -{ -public: - QWSGLWindowSurfacePrivate() : - qglContext(0), ownsContext(false) {} - - QGLContext *qglContext; - bool ownsContext; -}; - -/*! - Constructs an empty QWSGLWindowSurface for the given top-level \a window. - The window surface is later initialized from chooseContext() and resources for it - is typically allocated in setGeometry(). -*/ -QWSGLWindowSurface::QWSGLWindowSurface(QWidget *window) - : QWSWindowSurface(window), - d_ptr(new QWSGLWindowSurfacePrivate) -{ -} - -/*! - Constructs an empty QWSGLWindowSurface. -*/ -QWSGLWindowSurface::QWSGLWindowSurface() - : d_ptr(new QWSGLWindowSurfacePrivate) -{ -} - -/*! - Destroys the QWSGLWindowSurface object and frees any - allocated resources. - */ -QWSGLWindowSurface::~QWSGLWindowSurface() -{ - Q_D(QWSGLWindowSurface); - if (d->ownsContext) - delete d->qglContext; - delete d; -} - -/*! - Returns the QGLContext of the window surface. -*/ -QGLContext *QWSGLWindowSurface::context() const -{ - Q_D(const QWSGLWindowSurface); - if (!d->qglContext) { - QWSGLWindowSurface *that = const_cast<QWSGLWindowSurface*>(this); - that->setContext(new QGLContext(QGLFormat::defaultFormat())); - that->d_func()->ownsContext = true; - } - return d->qglContext; -} - -/*! - Sets the QGLContext for this window surface to \a context. -*/ -void QWSGLWindowSurface::setContext(QGLContext *context) -{ - Q_D(QWSGLWindowSurface); - if (d->ownsContext) { - delete d->qglContext; - d->ownsContext = false; - } - d->qglContext = context; -} - -QT_END_NAMESPACE diff --git a/src/opengl/qglwindowsurface_qws_p.h b/src/opengl/qglwindowsurface_qws_p.h deleted file mode 100644 index 41d77e8e2d..0000000000 --- a/src/opengl/qglwindowsurface_qws_p.h +++ /dev/null @@ -1,90 +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 QtOpenGL module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGLWINDOWSURFACE_QWS_P_H -#define QGLWINDOWSURFACE_QWS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of the QWSGLWindowSurface class. This header file may change from -// version to version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qglobal.h> -#include <QPaintDevice> -#include "private/qwindowsurface_qws_p.h" - -QT_BEGIN_NAMESPACE - -class QPaintDevice; -class QPoint; -class QRegion; -class QSize; -class QWidget; -class QGLContext; - -class QWSGLWindowSurfacePrivate; - -class Q_OPENGL_EXPORT QWSGLWindowSurface : public QWSWindowSurface -{ - Q_DECLARE_PRIVATE(QWSGLWindowSurface) - -public: - QWSGLWindowSurface(QWidget *widget); - QWSGLWindowSurface(); - ~QWSGLWindowSurface(); - - QGLContext *context() const; - void setContext(QGLContext *context); - -private: - QWSGLWindowSurfacePrivate *d_ptr; -}; - - -QT_END_NAMESPACE - -#endif // QGLWINDOWSURFACE_QWS_P_H |