1 | // Copyright (C) 2020 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 | #ifndef QEGLCONVENIENCE_H |
5 | #define QEGLCONVENIENCE_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtGui/qsurfaceformat.h> |
19 | #include <QtCore/qlist.h> |
20 | #include <QtCore/qsize.h> |
21 | |
22 | #include <QtGui/private/qt_egl_p.h> |
23 | |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | Q_GUI_EXPORT QList<EGLint> q_createConfigAttributesFromFormat(const QSurfaceFormat &format); |
28 | |
29 | Q_GUI_EXPORT bool q_reduceConfigAttributes(QList<EGLint> *configAttributes); |
30 | |
31 | Q_GUI_EXPORT EGLConfig q_configFromGLFormat(EGLDisplay display, |
32 | const QSurfaceFormat &format, |
33 | bool highestPixelFormat = false, |
34 | int surfaceType = EGL_WINDOW_BIT); |
35 | |
36 | Q_GUI_EXPORT QSurfaceFormat q_glFormatFromConfig(EGLDisplay display, const EGLConfig config, |
37 | const QSurfaceFormat &referenceFormat = {}); |
38 | |
39 | Q_GUI_EXPORT bool q_hasEglExtension(EGLDisplay display,const char* extensionName); |
40 | |
41 | Q_GUI_EXPORT void q_printEglConfig(EGLDisplay display, EGLConfig config); |
42 | |
43 | #ifdef Q_OS_UNIX |
44 | Q_GUI_EXPORT QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, |
45 | const QSize &screenSize = {}); |
46 | |
47 | Q_GUI_EXPORT QSize q_screenSizeFromFb(int framebufferDevice); |
48 | |
49 | Q_GUI_EXPORT int q_screenDepthFromFb(int framebufferDevice); |
50 | |
51 | Q_GUI_EXPORT qreal q_refreshRateFromFb(int framebufferDevice); |
52 | |
53 | #endif |
54 | |
55 | class Q_GUI_EXPORT QEglConfigChooser |
56 | { |
57 | public: |
58 | QEglConfigChooser(EGLDisplay display); |
59 | virtual ~QEglConfigChooser(); |
60 | |
61 | EGLDisplay display() const { return m_display; } |
62 | |
63 | void setSurfaceType(EGLint surfaceType) { m_surfaceType = surfaceType; } |
64 | EGLint surfaceType() const { return m_surfaceType; } |
65 | |
66 | void setSurfaceFormat(const QSurfaceFormat &format) { m_format = format; } |
67 | QSurfaceFormat surfaceFormat() const { return m_format; } |
68 | |
69 | void setIgnoreColorChannels(bool ignore) { m_ignore = ignore; } |
70 | bool ignoreColorChannels() const { return m_ignore; } |
71 | |
72 | EGLConfig chooseConfig(); |
73 | |
74 | protected: |
75 | virtual bool filterConfig(EGLConfig config) const; |
76 | |
77 | QSurfaceFormat m_format; |
78 | EGLDisplay m_display; |
79 | EGLint m_surfaceType; |
80 | bool m_ignore; |
81 | |
82 | int m_confAttrRed; |
83 | int m_confAttrGreen; |
84 | int m_confAttrBlue; |
85 | int m_confAttrAlpha; |
86 | }; |
87 | |
88 | |
89 | QT_END_NAMESPACE |
90 | |
91 | #endif //QEGLCONVENIENCE_H |
92 | |