summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2025-08-24 02:57:01 +0300
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2025-08-27 14:57:46 +0300
commitb25c1e8452ecffa70b4b75fdb579f08187b36a63 (patch)
tree8fc361a9a19f9f5a4481cd1d6533024c4b6511a5 /src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
parent1678e8ac463d189db416f41bd0680ce5954529d4 (diff)
Android: split and rename checkNativeSurface()
This function is doing more than what's obvious from the name, it checks if the surface has been created and creates the egl surface and then calls sendExpose(). This splits and renamed to one call for checking if the surface, then sendExpose() is moved to the existing createEgl(). Pick-to: 6.10 Change-Id: Ie15123324fca68df4a66c386916f13d691ac66c6 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformopenglwindow.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglwindow.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
index c3f3110f2bf..40de78b978a 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp
@@ -73,26 +73,22 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config)
m_surfaceWaitCondition.wait(&m_surfaceMutex);
}
- if (m_eglSurface == EGL_NO_SURFACE) {
- checkNativeSurface(config);
- }
+ if (m_eglSurface == EGL_NO_SURFACE)
+ createEgl(config);
+
return m_eglSurface;
}
-// Only called by eglSurface() and QAndroidPlatformOpenGLContext::swapBuffers(),
-// m_surfaceMutex already locked
-bool QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
+// m_surfaceMutex already locked, called only by eglSurface()
+// and QAndroidPlatformOpenGLContext::swapBuffers().
+bool QAndroidPlatformOpenGLWindow::makeCurrentNeeded() const
{
// Either no surface created, or the m_eglSurface already wraps the active Surface
// -> makeCurrent is NOT needed, and we should not create a new EGL surface
if (!m_surfaceCreated || !m_androidSurfaceObject.isValid())
return false;
- createEgl(config);
-
- // we've created another Surface, the window should be repainted
- sendExpose();
- return true; // makeCurrent is needed!
+ return true;
}
void QAndroidPlatformOpenGLWindow::applicationStateChanged(Qt::ApplicationState state)
@@ -106,6 +102,8 @@ void QAndroidPlatformOpenGLWindow::applicationStateChanged(Qt::ApplicationState
}
}
+// m_surfaceMutex already locked, called only by eglSurface()
+// and QAndroidPlatformOpenGLContext::swapBuffers().
void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
{
clearSurface();
@@ -119,6 +117,9 @@ void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
eglTerminate(m_eglDisplay);
qFatal("EGL Error : Could not create the egl surface: error = 0x%x\n", error);
}
+
+ // we've created another Surface, the window should be repainted
+ sendExpose();
}
QSurfaceFormat QAndroidPlatformOpenGLWindow::format() const