diff options
Diffstat (limited to 'src/opengl/qgl_p.h')
-rw-r--r-- | src/opengl/qgl_p.h | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 2e8ac88..1957429 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -233,6 +233,7 @@ private: QGLExtensionFuncs m_extensionFuncs; const QGLContext *m_context; // context group's representative + QList<const QGLContext *> m_shares; QAtomicInt m_refs; friend class QGLShareRegister; @@ -343,13 +344,11 @@ public: #ifdef Q_WS_WIN static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *ctx) { return ctx->d_ptr->group->extensionFuncs(); } - static inline QGLExtensionFuncs& extensionFuncs(QGLContextGroup *ctx) { return ctx->extensionFuncs(); } #endif #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) static QGLExtensionFuncs qt_extensionFuncs; static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *) { return qt_extensionFuncs; } - static inline QGLExtensionFuncs& extensionFuncs(QGLContextGroup *) { return qt_extensionFuncs; } #endif static void setCurrentContext(QGLContext *context); @@ -399,21 +398,15 @@ public: Q_DECLARE_OPERATORS_FOR_FLAGS(QGLExtensions::Extensions) -class QGLShareRegister +class Q_AUTOTEST_EXPORT QGLShareRegister { public: QGLShareRegister() {} - ~QGLShareRegister() { reg.clear(); } + ~QGLShareRegister() {} - bool checkSharing(const QGLContext *context1, const QGLContext *context2); void addShare(const QGLContext *context, const QGLContext *share); QList<const QGLContext *> shares(const QGLContext *context); void removeShare(const QGLContext *context); -private: - // Use a context's 'group' pointer to uniquely identify a group. - typedef QList<const QGLContext *> ContextList; - typedef QHash<const QGLContextGroup *, ContextList> SharingHash; - SharingHash reg; }; extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg(); @@ -436,7 +429,7 @@ public: QGLContext *current = const_cast<QGLContext *>(QGLContext::currentContext()); QGLContext *ctx = const_cast<QGLContext *>(context); Q_ASSERT(ctx); - bool switch_context = current != ctx && !qgl_share_reg()->checkSharing(current, ctx); + bool switch_context = current != ctx && !QGLContext::areSharing(current, ctx); if (switch_context) ctx->makeCurrent(); #if defined(Q_WS_X11) @@ -491,8 +484,6 @@ private: #ifdef Q_WS_QWS extern QPaintEngine* qt_qgl_paint_engine(); - -extern EGLDisplay qt_qgl_egl_display(); #endif bool qt_gl_preferGL2Engine(); @@ -547,7 +538,7 @@ public: : m_oldContext(0) { QGLContext *currentContext = const_cast<QGLContext *>(QGLContext::currentContext()); - if (currentContext != ctx && !qgl_share_reg()->checkSharing(ctx, currentContext)) { + if (currentContext != ctx && !QGLContext::areSharing(ctx, currentContext)) { m_oldContext = currentContext; m_ctx = const_cast<QGLContext *>(ctx); m_ctx->makeCurrent(); |