Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qxcbeglwindow.cpp
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
6
8
9#include <QtGui/private/qeglconvenience_p.h>
10
11#ifndef EGL_EXT_platform_base
12typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
13#endif
14
15QT_BEGIN_NAMESPACE
16
17QXcbEglWindow::QXcbEglWindow(QWindow *window, QXcbEglIntegration *glIntegration)
18 : QXcbWindow(window)
19 , m_glIntegration(glIntegration)
20 , m_config(nullptr)
21 , m_surface(EGL_NO_SURFACE)
22{
23}
24
26{
27 eglDestroySurface(m_glIntegration->eglDisplay(), m_surface);
28}
29
30void QXcbEglWindow::resolveFormat(const QSurfaceFormat &format)
31{
32 m_config = q_configFromGLFormat(m_glIntegration->eglDisplay(), format);
33 m_format = q_glFormatFromConfig(m_glIntegration->eglDisplay(), m_config, format);
34}
35
36const xcb_visualtype_t *QXcbEglWindow::createVisual()
37{
38 QXcbScreen *scr = xcbScreen();
39 if (!scr)
40 return QXcbWindow::createVisual();
41
42 xcb_visualid_t id = m_glIntegration->getCompatibleVisualId(scr->screen(), m_config);
43 return scr->visualForId(id);
44}
45
47{
48 QXcbWindow::create();
49
50 // this is always true without egl_x11
51 if (m_glIntegration->usingPlatformDisplay()) {
52 auto createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
53 eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT"));
54 m_surface = createPlatformWindowSurface(m_glIntegration->eglDisplay(),
55 m_config,
56 reinterpret_cast<void *>(&m_window),
57 nullptr);
58 return;
59 }
60
61#if QT_CONFIG(egl_x11)
62 m_surface = eglCreateWindowSurface(m_glIntegration->eglDisplay(), m_config, m_window, nullptr);
63#endif
64}
65
66QT_END_NAMESPACE
void resolveFormat(const QSurfaceFormat &format) override
const xcb_visualtype_t * createVisual() override
void create() override
EGLConfig void * native_window
typedef EGLSurface(EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay dpy
EGLConfig void const EGLint * attrib_list