Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qandroidplatformopenglwindow.cpp
Go to the documentation of this file.
1
// Copyright (C) 2014 BogDan Vatra <bogdan@kde.org>
2
// Copyright (C) 2016 The Qt Company Ltd.
3
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
// Qt-Security score:significant reason:default
5
6
#
include
"qandroidplatformopenglwindow.h"
7
8
#
include
"androidjnimain.h"
9
#
include
"qandroidplatformscreen.h"
10
11
#
include
<
QSurfaceFormat
>
12
#
include
<
QtGui
/
private
/
qwindow_p
.
h
>
13
#
include
<
QtGui
/
qguiapplication
.
h
>
14
15
#
include
<
QtGui
/
private
/
qeglconvenience_p
.
h
>
16
#
include
<
android
/
native_window
.
h
>
17
#
include
<
android
/
native_window_jni
.
h
>
18
#
include
<
qpa
/
qplatformscreen
.
h
>
19
#
include
<
qpa
/
qwindowsysteminterface
.
h
>
20
21
QT_BEGIN_NAMESPACE
22
23
QAndroidPlatformOpenGLWindow
::
QAndroidPlatformOpenGLWindow
(
QWindow
*
window
,
EGLDisplay
display
)
24
:
QAndroidPlatformWindow
(window), m_eglDisplay(display)
25
{ }
26
27
QAndroidPlatformOpenGLWindow::~QAndroidPlatformOpenGLWindow()
28
{
29
// The base class destructor can't reach destroyWindowSurface().
30
destroySurface();
31
}
32
33
void
QAndroidPlatformOpenGLWindow
::setGeometry(
const
QRect &rect)
34
{
35
QAndroidPlatformWindow::setGeometry(rect);
36
37
// Programmatic resizes need an expose to drive Qt-internal re-layout on
38
// widget-embedded scenes (QQuickWidget).
39
if
(!rect.isEmpty() && !screen()->availableGeometry().isEmpty())
40
QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(), rect.size())));
41
}
42
43
EGLSurface
QAndroidPlatformOpenGLWindow
::
eglSurface
(EGLConfig config)
44
{
45
if
(Q_LIKELY(m_eglSurface != EGL_NO_SURFACE))
46
return
m_eglSurface;
47
ensureNativeWindow
();
48
if
(!m_nativeWindow)
49
return
EGL_NO_SURFACE;
50
51
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, m_nativeWindow,
nullptr
);
52
if
(Q_UNLIKELY(m_eglSurface == EGL_NO_SURFACE)) {
53
qWarning(
"EGL Error: could not create egl surface: 0x%x"
, eglGetError());
54
return
EGL_NO_SURFACE;
55
}
56
m_format = q_glFormatFromConfig(m_eglDisplay, config, window()->requestedFormat());
57
return
m_eglSurface;
58
}
59
60
QSurfaceFormat
QAndroidPlatformOpenGLWindow
::
format
()
const
61
{
62
if
(!m_nativeWindow)
63
return
window()->requestedFormat();
64
return
m_format;
65
}
66
67
void
QAndroidPlatformOpenGLWindow
::
destroyWindowSurface
()
68
{
69
if
(m_eglSurface != EGL_NO_SURFACE) {
70
eglDestroySurface(m_eglDisplay, m_eglSurface);
71
m_eglSurface = EGL_NO_SURFACE;
72
}
73
}
74
75
QT_END_NAMESPACE
QAndroidPlatformOpenGLWindow
Definition
qandroidplatformopenglwindow.h:19
QAndroidPlatformOpenGLWindow::eglSurface
EGLSurface eglSurface(EGLConfig config)
Definition
qandroidplatformopenglwindow.cpp:43
QAndroidPlatformOpenGLWindow::destroyWindowSurface
void destroyWindowSurface() override
Definition
qandroidplatformopenglwindow.cpp:67
QAndroidPlatformOpenGLWindow::format
QSurfaceFormat format() const override
Returns the actual surface format of the window.
Definition
qandroidplatformopenglwindow.cpp:60
QAndroidPlatformWindow
Definition
qandroidplatformwindow.h:41
QAndroidPlatformWindow::ensureNativeWindow
void ensureNativeWindow()
Definition
qandroidplatformwindow.cpp:421
QWindow
\inmodule QtGui
Definition
qwindow.h:64
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtbase
src
plugins
platforms
android
qandroidplatformopenglwindow.cpp
Generated on
for Qt by
1.18.0