| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "qxcbglintegration.h" |
| 7 | |
| 8 | #include "qxcbeglwindow.h" |
| 9 | |
| 10 | #include <QtGui/QOpenGLContext> |
| 11 | #include <qpa/qplatformopenglcontext.h> |
| 12 | #include <QtGui/qpa/qplatformscreen.h> |
| 13 | #include <QtGui/QScreen> |
| 14 | |
| 15 | #include "qxcbscreen.h" |
| 16 | |
| 17 | #include "qxcbeglinclude.h" |
| 18 | |
| 19 | QT_BEGIN_NAMESPACE |
| 20 | |
| 21 | class QXcbEglNativeInterfaceHandler; |
| 22 | |
| 23 | class QXcbEglIntegration : public QXcbGlIntegration |
| 24 | , public QNativeInterface::Private::QEGLIntegration |
| 25 | { |
| 26 | public: |
| 27 | QXcbEglIntegration(); |
| 28 | ~QXcbEglIntegration(); |
| 29 | |
| 30 | bool initialize(QXcbConnection *connection) override; |
| 31 | |
| 32 | QXcbWindow *createWindow(QWindow *window) const override; |
| 33 | QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; |
| 34 | QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override; |
| 35 | QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; |
| 36 | |
| 37 | bool supportsThreadedOpenGL() const override { return true; } |
| 38 | |
| 39 | EGLDisplay eglDisplay() const { return m_egl_display; } |
| 40 | |
| 41 | bool usingPlatformDisplay() const { return m_using_platform_display; } |
| 42 | |
| 43 | xcb_visualid_t getCompatibleVisualId(xcb_screen_t *screen, EGLConfig config) const; |
| 44 | private: |
| 45 | QXcbConnection *m_connection; |
| 46 | EGLDisplay m_egl_display; |
| 47 | bool m_using_platform_display; |
| 48 | |
| 49 | QScopedPointer<QXcbEglNativeInterfaceHandler> m_native_interface_handler; |
| 50 | }; |
| 51 | |
| 52 | QT_END_NAMESPACE |
| 53 |
