QAndroidPlatformOpenGLContext: fix adopting of existing native contexts

Change-Id: I854bbc511d89578c6a893015b21358f08ed8f5a6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
Laszlo Agocs 2016-12-06 08:17:30 +01:00 committed by J-P Nurmi
parent b0c321a8db
commit 8005e0652c
3 changed files with 9 additions and 4 deletions

View File

@ -66,6 +66,8 @@
#include "qandroidplatformtheme.h"
#include "qandroidsystemlocale.h"
#include <QtPlatformHeaders/QEGLNativeContext>
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>(QEGLNativeContext(ctx->eglContext(), m_eglDisplay)));
return ctx;
}
QPlatformOffscreenSurface *QAndroidPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const

View File

@ -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)
{
}

View File

@ -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;