diff options
Diffstat (limited to 'src/gui/kernel/qplatformglcontext_qpa.h')
-rw-r--r-- | src/gui/kernel/qplatformglcontext_qpa.h | 60 |
1 files changed, 37 insertions, 23 deletions
diff --git a/src/gui/kernel/qplatformglcontext_qpa.h b/src/gui/kernel/qplatformglcontext_qpa.h index 1e64f4a781..30d7186bd1 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.h +++ b/src/gui/kernel/qplatformglcontext_qpa.h @@ -39,11 +39,12 @@ ** ****************************************************************************/ -#ifndef QPLATFORM_GL_CONTEXT_H -#define QPLATFORM_GL_CONTEXT_H +#ifndef QPLATFORMGLCONTEXT_H +#define QPLATFORMGLCONTEXT_H #include <QtCore/qnamespace.h> -#include <QtGui/QPlatformWindowFormat> +#include <QtGui/qsurfaceformat.h> +#include <QtGui/qwindow.h> QT_BEGIN_HEADER @@ -51,36 +52,49 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) +class Q_GUI_EXPORT QPlatformSurface +{ +public: + virtual QSurfaceFormat format() const = 0; + + QSurface::SurfaceType surfaceType() const { return m_type; } + +private: + QPlatformSurface(QSurface::SurfaceType type) : m_type(type) {} + + QSurface::SurfaceType m_type; + + friend class QPlatformWindow; +}; + class QPlatformGLContextPrivate; -class Q_OPENGL_EXPORT QPlatformGLContext +class Q_GUI_EXPORT QPlatformGLContext { -Q_DECLARE_PRIVATE(QPlatformGLContext); - + Q_DECLARE_PRIVATE(QPlatformGLContext) public: - explicit QPlatformGLContext(); + QPlatformGLContext(); virtual ~QPlatformGLContext(); - virtual void makeCurrent(); - virtual void doneCurrent(); - virtual void swapBuffers() = 0; - virtual void* getProcAddress(const QString& procName) = 0; + virtual QSurfaceFormat format() const = 0; - virtual QPlatformWindowFormat platformWindowFormat() const = 0; + virtual void swapBuffers(QPlatformSurface *surface) = 0; - const static QPlatformGLContext *currentContext(); + virtual bool makeCurrent(QPlatformSurface *surface) = 0; + virtual void doneCurrent() = 0; -protected: - QScopedPointer<QPlatformGLContextPrivate> d_ptr; + virtual void (*getProcAddress(const QByteArray &procName)) () = 0; + + QGuiGLContext *context() const; private: - //hack to make it work with QGLContext::CurrentContext - friend class QGLContext; - friend class QWidgetPrivate; - void *qGLContextHandle() const; - void setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *)); - void deleteQGLContext(); - Q_DISABLE_COPY(QPlatformGLContext); + friend class QGuiGLContext; + + QScopedPointer<QPlatformGLContextPrivate> d_ptr; + + void setContext(QGuiGLContext *context); + + Q_DISABLE_COPY(QPlatformGLContext) }; QT_END_NAMESPACE @@ -88,4 +102,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QPLATFORM_GL_INTEGRATION_P_H +#endif // QPLATFORMGLCONTEXT_H |