summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-08-16 09:28:01 +0200
committerJørgen Lind <jorgen.lind@nokia.com>2011-08-16 13:53:13 +0200
commit1ff94e314835682b178eac98c3c1be983e71c4ca (patch)
tree93e9547b5cc44484ec1411994013e649f8f683a1 /src/opengl
parent30774e9552591746a2640ba39c7afdc052952597 (diff)
Get rid of unused convenience class in QtOpenGL.
QGLContextResource is no longer used, QGLContextGroupResource should be preferable in all situations. Change-Id: I7c7b90686959ced9fa34e278ef5747a7c49a5b03 Reviewed-on: http://codereview.qt.nokia.com/3005 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp4
-rw-r--r--src/opengl/qgl_p.h64
-rw-r--r--src/opengl/qglfunctions.cpp8
3 files changed, 0 insertions, 76 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index d045bf55d1..4f9f5a9414 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2105,10 +2105,6 @@ QGLContext::~QGLContext()
void QGLContextPrivate::cleanup()
{
- QHash<QGLContextResourceBase *, void *>::ConstIterator it;
- for (it = m_resources.begin(); it != m_resources.end(); ++it)
- it.key()->freeResource(it.value());
- m_resources.clear();
}
#define ctx q_ptr
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index f2590e82b1..f418008203 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -433,7 +433,6 @@ public:
GLuint current_fbo;
GLuint default_fbo;
QPaintEngine *active_engine;
- QHash<QGLContextResourceBase *, void *> m_resources;
QGLTextureDestroyer *texture_destroyer;
QGLFunctions *functions;
@@ -739,69 +738,6 @@ protected:
}
};
-/*
- Base for resources that are context specific.
-*/
-class Q_OPENGL_EXPORT QGLContextResourceBase
-{
-public:
- virtual ~QGLContextResourceBase() {
- for (int i = 0; i < m_contexts.size(); ++i)
- m_contexts.at(i)->d_ptr->m_resources.remove(this);
- }
-
- void insert(const QGLContext *context, void *value) {
- context->d_ptr->m_resources.insert(this, value);
- }
-
- void *value(const QGLContext *context) {
- return context->d_ptr->m_resources.value(this, 0);
- }
- virtual void freeResource(void *value) = 0;
-
-protected:
- QList<const QGLContext *> m_contexts;
-};
-
-/*
- The QGLContextResource template is used to manage a resource for a
- single GL context. Just before the context is destroyed (while it's
- still the current context), or when the QGLContextResource object
- itself is destroyed (implies potential context switches), the
- resource will be freed. The class used as the template class type
- needs to have a constructor with the following signature: T(const
- QGLContext *);
-*/
-template <class T>
-class QGLContextResource : public QGLContextResourceBase
-{
-public:
- ~QGLContextResource() {
- for (int i = 0; i < m_contexts.size(); ++i) {
- const QGLContext *context = m_contexts.at(i);
- T *resource = reinterpret_cast<T *>(QGLContextResourceBase::value(context));
- if (resource) {
- QGLShareContextScope scope(context);
- delete resource;
- }
- }
- }
-
- T *value(const QGLContext *context) {
- T *resource = reinterpret_cast<T *>(QGLContextResourceBase::value(context));
- if (!resource) {
- resource = new T(context);
- insert(context, resource);
- }
- return resource;
- }
-
-protected:
- void freeResource(void *resource) {
- delete reinterpret_cast<T *>(resource);
- }
-};
-
// Put a guard around a GL object identifier and its context.
// When the context goes away, a shared context will be used
// in its place. If there are no more shared contexts, then
diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp
index 02e7091c9e..48549fb8d2 100644
--- a/src/opengl/qglfunctions.cpp
+++ b/src/opengl/qglfunctions.cpp
@@ -148,16 +148,8 @@ struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate
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_WITH_ARGS(QGLContextResource, qt_gl_functions_resource, (qt_gl_functions_free))
-#endif
static QGLFunctionsPrivateEx *qt_gl_functions(const QGLContext *context = 0)
{
if (!context)