diff options
Diffstat (limited to 'src')
3 files changed, 16 insertions, 15 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index 00b2af18b3a..a6cc706785e 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -34,7 +34,8 @@ void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface) // by Android window->lockSurface(); - if (window->checkNativeSurface(eglConfig())) { + if (window->makeCurrentNeeded()) { + window->createEgl(eglConfig()); // Call base class implementation directly since we are already locked QEGLPlatformContext::makeCurrent(surface); } 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 diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h index 6e31bf68fd6..4d375757061 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h @@ -23,14 +23,13 @@ public: void setGeometry(const QRect &rect) override; EGLSurface eglSurface(EGLConfig config); + void createEgl(EGLConfig config); QSurfaceFormat format() const override; - - bool checkNativeSurface(EGLConfig config); + bool makeCurrentNeeded() const; void applicationStateChanged(Qt::ApplicationState) override; protected: - void createEgl(EGLConfig config); void clearSurface() override; private: |
