summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformglcontext_qpa.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qplatformglcontext_qpa.cpp')
-rw-r--r--src/gui/kernel/qplatformglcontext_qpa.cpp128
1 files changed, 0 insertions, 128 deletions
diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp
index 181053223f..2177a01d9b 100644
--- a/src/gui/kernel/qplatformglcontext_qpa.cpp
+++ b/src/gui/kernel/qplatformglcontext_qpa.cpp
@@ -41,134 +41,6 @@
#include "qplatformglcontext_qpa.h"
-#include <QtCore/QThreadStorage>
-#include <QtCore/QThread>
-
-#include <QDebug>
-
-class QPlatformGLThreadContext
-{
-public:
- ~QPlatformGLThreadContext() {
- if (context)
- context->doneCurrent();
- }
- QPlatformGLContext *context;
-};
-
-static QThreadStorage<QPlatformGLThreadContext *> qplatformgl_context_storage;
-
-class QPlatformGLContextPrivate
-{
-public:
- QPlatformGLContextPrivate()
- :qGLContextHandle(0)
- {
- }
-
- virtual ~QPlatformGLContextPrivate()
- {
- //do not delete the QGLContext handle here as it is deleted in
- //QWidgetPrivate::deleteTLSysExtra()
- }
- void *qGLContextHandle;
- void (*qGLContextDeleteFunction)(void *handle);
- static QPlatformGLContext *staticSharedContext;
-
- static void setCurrentContext(QPlatformGLContext *context);
-};
-
-QPlatformGLContext *QPlatformGLContextPrivate::staticSharedContext = 0;
-
-void QPlatformGLContextPrivate::setCurrentContext(QPlatformGLContext *context)
-{
- QPlatformGLThreadContext *threadContext = qplatformgl_context_storage.localData();
- if (!threadContext) {
- if (!QThread::currentThread()) {
- qWarning("No QTLS available. currentContext wont work");
- return;
- }
- threadContext = new QPlatformGLThreadContext;
- qplatformgl_context_storage.setLocalData(threadContext);
- }
- threadContext->context = context;
-}
-
-/*!
- Returns the last context which called makeCurrent. This function is thread aware.
-*/
-const QPlatformGLContext* QPlatformGLContext::currentContext()
-{
- QPlatformGLThreadContext *threadContext = qplatformgl_context_storage.localData();
- if(threadContext) {
- return threadContext->context;
- }
- return 0;
-}
-
-/*!
- All subclasses needs to specify the platformWindow. It can be a null window.
-*/
-QPlatformGLContext::QPlatformGLContext()
- :d_ptr(new QPlatformGLContextPrivate())
-{
-}
-
-/*!
- If this is the current context for the thread, doneCurrent is called
-*/
-QPlatformGLContext::~QPlatformGLContext()
-{
- if (QPlatformGLContext::currentContext() == this) {
- doneCurrent();
- }
-
-}
-
-/*!
- Reimplement in subclass to do makeCurrent on native GL context
-*/
-void QPlatformGLContext::makeCurrent()
-{
- QPlatformGLContextPrivate::setCurrentContext(this);
-}
-
-/*!
- Reimplement in subclass to release current context.
- Typically this is calling makeCurrent with 0 "surface"
-*/
-void QPlatformGLContext::doneCurrent()
-{
- QPlatformGLContextPrivate::setCurrentContext(0);
-}
-
-/*
- internal: Needs to have a pointer to qGLContext. But since this is in QtGui we cant
- have any type information.
-*/
-void *QPlatformGLContext::qGLContextHandle() const
-{
- Q_D(const QPlatformGLContext);
- return d->qGLContextHandle;
-}
-
-void QPlatformGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *))
-{
- Q_D(QPlatformGLContext);
- d->qGLContextHandle = handle;
- d->qGLContextDeleteFunction = qGLContextDeleteFunction;
-}
-
-void QPlatformGLContext::deleteQGLContext()
-{
- Q_D(QPlatformGLContext);
- if (d->qGLContextDeleteFunction && d->qGLContextHandle) {
- d->qGLContextDeleteFunction(d->qGLContextHandle);
- d->qGLContextDeleteFunction = 0;
- d->qGLContextHandle = 0;
- }
-}
-
/*!
\class QPlatformGLContext
\since 4.8