blob: 36546879ae4cab98749af18b01e4de1e5caa301e (
plain)
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | // Copyright (C) 2016 The Qt Company Ltd.// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only#ifndef QCOCOAGLCONTEXT_H#define QCOCOAGLCONTEXT_H#include <QtCore/QPointer>#include <QtCore/QVarLengthArray>#include <QtCore/private/qcore_mac_p.h>#include <qpa/qplatformopenglcontext.h>#include <QtGui/qopenglcontext.h>#include <QtGui/private/qopenglcontext_p.h>#include <QtGui/QWindow>Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLContext);Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLPixelFormat); QT_BEGIN_NAMESPACE class QCocoaWindow;class QCocoaGLContext :public QPlatformOpenGLContext,public QNativeInterface::QCocoaGLContext {public:QCocoaGLContext(QOpenGLContext *context);QCocoaGLContext(NSOpenGLContext *context);~QCocoaGLContext();voidinitialize() override;boolmakeCurrent(QPlatformSurface *surface) override;voidbeginFrame() override;voidswapBuffers(QPlatformSurface *surface) override;voiddoneCurrent() override;voidupdate(); QSurfaceFormat format()const override;boolisSharing()const override;boolisValid()const override; NSOpenGLContext *nativeContext()const override; QFunctionPointer getProcAddress(const char*procName) override;private:static NSOpenGLPixelFormat *pixelFormatForSurfaceFormat(const QSurfaceFormat &format);boolsetDrawable(QPlatformSurface *surface);voidupdateSurfaceFormat(); NSOpenGLContext *m_context = nil; NSOpenGLContext *m_shareContext = nil; QSurfaceFormat m_format; QVarLengthArray<QMacNotificationObserver,3> m_updateObservers; QAtomicInt m_needsUpdate =false;#ifndef QT_NO_DEBUG_STREAMfriend QDebug operator<<(QDebug debug,const QCocoaGLContext *screen);#endif}; QT_END_NAMESPACE #endif// QCOCOAGLCONTEXT_H
|