summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-11-18 12:03:59 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-11-22 13:14:08 (GMT)
commit292f6a9ba1b5da049e4898525974c6f0575ccd65 (patch)
treeb44bdf07f56298d7206a180a41690c2de3371fc6 /src/plugins
parenta1acef227647b3043998f9ccf364ead5c29b882d (diff)
downloadQt-292f6a9ba1b5da049e4898525974c6f0575ccd65.zip
Qt-292f6a9ba1b5da049e4898525974c6f0575ccd65.tar.gz
Qt-292f6a9ba1b5da049e4898525974c6f0575ccd65.tar.bz2
Lighthouse: move the currentContext functionality to QPlatformGLContext
This means the threading functionality has been delegated down to QPlatformGLContext. However, it is still possible to use QGLContext::currentContext to retrieve the QGLContext. This so that QGLFunctions, QGLShaderProgram etc can be used without a QGLWidget. Reviewed-by: paul
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp6
-rw-r--r--src/plugins/platforms/eglconvenience/qeglplatformcontext.h2
-rw-r--r--src/plugins/platforms/testlite/qglxintegration.cpp12
-rw-r--r--src/plugins/platforms/testlite/qglxintegration.h4
-rw-r--r--src/plugins/platforms/testlite/qtestlitewindow.cpp2
5 files changed, 15 insertions, 11 deletions
diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
index ae3b539..a169c35 100644
--- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
+++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp
@@ -48,8 +48,8 @@
#include <EGL/egl.h>
-QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi)
- : QPlatformGLContext()
+QEGLPlatformContext::QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi, QPlatformWindow *platformWindow)
+ : QPlatformGLContext(platformWindow)
, m_eglDisplay(display)
, m_eglSurface(surface)
, m_eglApi(eglApi)
@@ -88,6 +88,7 @@ QEGLPlatformContext::~QEGLPlatformContext()
void QEGLPlatformContext::makeCurrent()
{
+ QPlatformGLContext::makeCurrent();
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglContext::makeCurrent: %p\n",this);
#endif
@@ -117,6 +118,7 @@ void QEGLPlatformContext::makeCurrent()
}
void QEGLPlatformContext::doneCurrent()
{
+ QPlatformGLContext::doneCurrent();
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglContext::doneCurrent:%p\n",this);
#endif
diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
index ae1a891..2c38aca 100644
--- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
+++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h
@@ -48,7 +48,7 @@
class QEGLPlatformContext : public QPlatformGLContext
{
public:
- QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi);
+ QEGLPlatformContext(EGLDisplay display, EGLConfig config, EGLint contextAttrs[], EGLSurface surface, EGLenum eglApi, QPlatformWindow *platformWindow);
~QEGLPlatformContext();
void makeCurrent();
diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp
index e262d5b..c35db9b 100644
--- a/src/plugins/platforms/testlite/qglxintegration.cpp
+++ b/src/plugins/platforms/testlite/qglxintegration.cpp
@@ -235,14 +235,14 @@ QPlatformWindowFormat QGLXGLContext::reducePlatformWindowFormat(const QPlatformW
return retFormat;
}
-QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format)
- : QPlatformGLContext()
+QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, QPlatformWindow *platformWindow, const QPlatformWindowFormat &format)
+ : QPlatformGLContext(platformWindow)
, m_xd(xd)
, m_drawable((Drawable)window)
, m_context(0)
{
- QPlatformGLContext *sharePlatformContext;
+ const QPlatformGLContext *sharePlatformContext;
if (format.useDefaultSharedContext()) {
if (!QPlatformGLContext::defaultSharedContext()) {
if (m_defaultSharedContextMutex.tryLock()){
@@ -259,7 +259,7 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow
}
GLXContext shareGlxContext = 0;
if (sharePlatformContext)
- shareGlxContext = static_cast<QGLXGLContext*>(sharePlatformContext)->glxContext();
+ shareGlxContext = static_cast<const QGLXGLContext*>(sharePlatformContext)->glxContext();
GLXFBConfig config = findConfig(xd,format);
m_context = glXCreateNewContext(xd->display,config,GLX_RGBA_TYPE,shareGlxContext,TRUE);
@@ -271,7 +271,7 @@ QGLXGLContext::QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindow
}
QGLXGLContext::QGLXGLContext(MyDisplay *display, Drawable drawable, GLXContext context)
- : QPlatformGLContext(), m_xd(display), m_drawable(drawable), m_context(context)
+ : QPlatformGLContext(0), m_xd(display), m_drawable(drawable), m_context(context)
{
}
@@ -313,6 +313,7 @@ void QGLXGLContext::createDefaultSharedContex(MyDisplay *xd)
void QGLXGLContext::makeCurrent()
{
+ QPlatformGLContext::makeCurrent();
#ifdef MYX11_DEBUG
qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context);
#endif
@@ -321,6 +322,7 @@ void QGLXGLContext::makeCurrent()
void QGLXGLContext::doneCurrent()
{
+ QPlatformGLContext::doneCurrent();
glXMakeCurrent(m_xd->display, 0, 0);
}
diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h
index 479be4b..432dec5 100644
--- a/src/plugins/platforms/testlite/qglxintegration.h
+++ b/src/plugins/platforms/testlite/qglxintegration.h
@@ -58,7 +58,7 @@ class MyDisplay;
class QGLXGLContext : public QPlatformGLContext
{
public:
- QGLXGLContext(Window window, MyDisplay *xd, const QPlatformWindowFormat &format);
+ QGLXGLContext(Window window, MyDisplay *xd, QPlatformWindow *platformWindow, const QPlatformWindowFormat &format);
~QGLXGLContext();
virtual void makeCurrent();
@@ -66,7 +66,7 @@ public:
virtual void swapBuffers();
virtual void* getProcAddress(const QString& procName);
- GLXContext glxContext() {return m_context;}
+ GLXContext glxContext() const {return m_context;}
QPlatformWindowFormat platformWindowFormat() const;
diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp
index 9f3c435..0a6e1ff 100644
--- a/src/plugins/platforms/testlite/qtestlitewindow.cpp
+++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp
@@ -1021,7 +1021,7 @@ QPlatformGLContext *QTestLiteWindow::glContext() const
if (!mGLContext) {
QTestLiteWindow *that = const_cast<QTestLiteWindow *>(this);
#ifndef QT_NO_OPENGL
- that->mGLContext = new QGLXGLContext(x_window, xd, widget()->platformWindowFormat());
+ that->mGLContext = new QGLXGLContext(x_window, xd, that,widget()->platformWindowFormat());
#endif
}
return mGLContext;