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
qeglfsoffscreenwindow.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
7#include <QtGui/QOffscreenSurface>
8#include <QtGui/private/qeglconvenience_p.h>
9
11
12/*
13 In some cases pbuffers are not available. Triggering QtGui's built-in
14 fallback for a hidden QWindow is not suitable for eglfs since this would be
15 treated as an attempt to create multiple top-level, native windows.
16
17 Therefore this class is provided as an alternative to QEGLPbuffer.
18
19 This class requires the hooks to implement createNativeOffscreenWindow().
20*/
21
22QEglFSOffscreenWindow::QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface)
23 : QPlatformOffscreenSurface(offscreenSurface)
24 , m_format(format)
25 , m_display(display)
26 , m_surface(EGL_NO_SURFACE)
27 , m_window(0)
28{
29 m_window = qt_egl_device_integration()->createNativeOffscreenWindow(format);
30 if (!m_window) {
31 qWarning("QEglFSOffscreenWindow: Failed to create native window");
32 return;
33 }
34 EGLConfig config = q_configFromGLFormat(m_display, m_format);
35 m_surface = eglCreateWindowSurface(m_display, config, m_window, nullptr);
36 if (m_surface != EGL_NO_SURFACE)
37 m_format = q_glFormatFromConfig(m_display, config);
38}
39
40QEglFSOffscreenWindow::~QEglFSOffscreenWindow()
41{
42 if (m_surface != EGL_NO_SURFACE)
43 eglDestroySurface(m_display, m_surface);
44 if (m_window)
45 qt_egl_device_integration()->destroyNativeWindow(m_window);
46}
47
48QT_END_NAMESPACE
Combined button and popup list for selecting options.