diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-09-13 08:54:45 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-09-13 08:54:45 +0200 |
commit | b62bd0584a7872b6917917009b707785b3abd077 (patch) | |
tree | 9981f274712c098cabbff0c4667672a3934e5393 /src/opengl/qglfunctions.cpp | |
parent | 5e10745dca1d10025404a9f268f03ae697fb10cc (diff) | |
parent | 97baad65f65783d2b5ff938f6217aec9434f2e5f (diff) |
Merge branch 'refactor'
Conflicts:
mkspecs/qws/linux-lsb-g++/qmake.conf
src/gui/image/qpixmap_mac.cpp
src/gui/painting/qpaintengine_x11.cpp
src/gui/painting/qtessellator.cpp
src/gui/text/qfontengine_qws.cpp
src/gui/text/qfontengine_x11.cpp
src/gui/widgets/qlinecontrol.cpp
src/opengl/qgl.h
src/opengl/qgl_x11egl.cpp
src/plugins/plugins.pro
Change-Id: If52dcd55cd55f2983a756c2f843967702b60a310
Diffstat (limited to 'src/opengl/qglfunctions.cpp')
-rw-r--r-- | src/opengl/qglfunctions.cpp | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp index 02e7091c9e..227e6cc176 100644 --- a/src/opengl/qglfunctions.cpp +++ b/src/opengl/qglfunctions.cpp @@ -41,6 +41,7 @@ #include "qglfunctions.h" #include "qgl_p.h" +#include "QtGui/private/qopenglcontext_p.h" QT_BEGIN_NAMESPACE @@ -139,25 +140,28 @@ QT_BEGIN_NAMESPACE */ // Hidden private fields for additional extension data. -struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate +struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate, public QOpenGLSharedResource { - QGLFunctionsPrivateEx(const QGLContext *context = 0) - : QGLFunctionsPrivate(context) + QGLFunctionsPrivateEx(QOpenGLContext *context) + : QGLFunctionsPrivate(QGLContext::fromOpenGLContext(context)) + , QOpenGLSharedResource(context->shareGroup()) , m_features(-1) {} + void invalidateResource() + { + m_features = -1; + } + + void freeResource(QOpenGLContext *) + { + // no gl resources to free + } + int m_features; }; -#if QT_VERSION >= 0x040800 -Q_GLOBAL_STATIC(QGLContextGroupResource<QGLFunctionsPrivateEx>, qt_gl_functions_resource) -#else -static void qt_gl_functions_free(void *data) -{ - delete reinterpret_cast<QGLFunctionsPrivateEx *>(data); -} +Q_GLOBAL_STATIC(QOpenGLMultiGroupSharedResource, qt_gl_functions_resource) -Q_GLOBAL_STATIC_WITH_ARGS(QGLContextResource, qt_gl_functions_resource, (qt_gl_functions_free)) -#endif static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0) { if (!context) @@ -165,13 +169,7 @@ static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0) Q_ASSERT(context); QGLFunctionsPrivateEx *funcs = reinterpret_cast<QGLFunctionsPrivateEx *> - (qt_gl_functions_resource()->value(context)); -#if QT_VERSION < 0x040800 - if (!funcs) { - funcs = new QGLFunctionsPrivateEx(); - qt_gl_functions_resource()->insert(context, funcs); - } -#endif + (qt_gl_functions_resource()->value<QGLFunctionsPrivateEx>(context->contextHandle())); return funcs; } |