Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5#include "qeglfshooks_p.h"
6#include <QtGui/QOffscreenSurface>
7#include <QtGui/private/qeglconvenience_p.h>
8
10
11/*
12 In some cases pbuffers are not available. Triggering QtGui's built-in
13 fallback for a hidden QWindow is not suitable for eglfs since this would be
14 treated as an attempt to create multiple top-level, native windows.
15
16 Therefore this class is provided as an alternative to QEGLPbuffer.
17
18 This class requires the hooks to implement createNativeOffscreenWindow().
19*/
20
22 : QPlatformOffscreenSurface(offscreenSurface)
23 , m_format(format)
24 , m_display(display)
25 , m_surface(EGL_NO_SURFACE)
26 , m_window(0)
27{
29 if (!m_window) {
30 qWarning("QEglFSOffscreenWindow: Failed to create native window");
31 return;
32 }
33 EGLConfig config = q_configFromGLFormat(m_display, m_format);
34 m_surface = eglCreateWindowSurface(m_display, config, m_window, nullptr);
35 if (m_surface != EGL_NO_SURFACE)
36 m_format = q_glFormatFromConfig(m_display, config);
37}
38
40{
41 if (m_surface != EGL_NO_SURFACE)
42 eglDestroySurface(m_display, m_surface);
43 if (m_window)
45}
46
virtual EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format)
virtual void destroyNativeWindow(EGLNativeWindowType window)
QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface)
\inmodule QtGui
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
EGLConfig q_configFromGLFormat(EGLDisplay display, const QSurfaceFormat &format, bool highestPixelFormat, int surfaceType)
QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, const QSurfaceFormat &referenceFormat)
QEglFSDeviceIntegration * qt_egl_device_integration()
EGLConfig config
typedef EGLDisplay(EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform
#define qWarning
Definition qlogging.h:166
GLint GLsizei GLsizei GLenum format