From 8005e0652c367c5e8c780a298d9fee4ce18a370a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 6 Dec 2016 08:17:30 +0100 Subject: QAndroidPlatformOpenGLContext: fix adopting of existing native contexts Change-Id: I854bbc511d89578c6a893015b21358f08ed8f5a6 Reviewed-by: Laszlo Agocs Reviewed-by: J-P Nurmi Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/qandroidplatformintegration.cpp | 6 +++++- src/plugins/platforms/android/qandroidplatformopenglcontext.cpp | 5 +++-- src/plugins/platforms/android/qandroidplatformopenglcontext.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 6669ee3176..de9e27e595 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -66,6 +66,8 @@ #include "qandroidplatformtheme.h" #include "qandroidsystemlocale.h" +#include + QT_BEGIN_NAMESPACE int QAndroidPlatformIntegration::m_defaultGeometryWidth = 320; @@ -251,7 +253,9 @@ QPlatformOpenGLContext *QAndroidPlatformIntegration::createPlatformOpenGLContext format.setRedBufferSize(8); format.setGreenBufferSize(8); format.setBlueBufferSize(8); - return new QAndroidPlatformOpenGLContext(format, context->shareHandle(), m_eglDisplay); + auto ctx = new QAndroidPlatformOpenGLContext(format, context->shareHandle(), m_eglDisplay, context->nativeHandle()); + context->setNativeHandle(QVariant::fromValue(QEGLNativeContext(ctx->eglContext(), m_eglDisplay))); + return ctx; } QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp index 2644fa27f6..eeec7a8106 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp @@ -49,8 +49,9 @@ QT_BEGIN_NAMESPACE -QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display) - :QEGLPlatformContext(format, share, display) +QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, + const QVariant &nativeHandle) + :QEGLPlatformContext(format, share, display, nullptr, nativeHandle) { } diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.h b/src/plugins/platforms/android/qandroidplatformopenglcontext.h index 87a0829655..3897b3166b 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglcontext.h +++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.h @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE class QAndroidPlatformOpenGLContext : public QEGLPlatformContext { public: - QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display); + QAndroidPlatformOpenGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, const QVariant &nativeHandle); void swapBuffers(QPlatformSurface *surface) override; bool makeCurrent(QPlatformSurface *surface) override; -- cgit v1.2.3