eglfs: Implement nativeResourceFunctionForContext

Add support for a get_egl_context NativeResourceForContextFunction to
the eglfs platform plugin.

Change-Id: I155952797f340dd00ab9864852add4b44d841042
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
Jan Arne Petersen 2013-07-07 14:44:38 +02:00 committed by The Qt Project
parent 3a0071e286
commit 47d27c3a53
2 changed files with 24 additions and 0 deletions

View File

@ -74,6 +74,8 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static void *eglContextForContext(QOpenGLContext *context);
QEglFSIntegration::QEglFSIntegration() QEglFSIntegration::QEglFSIntegration()
: mEventDispatcher(createUnixEventDispatcher()), mFontDb(new QGenericUnixFontDatabase()) : mEventDispatcher(createUnixEventDispatcher()), mFontDb(new QGenericUnixFontDatabase())
{ {
@ -215,6 +217,26 @@ void *QEglFSIntegration::nativeResourceForContext(const QByteArray &resource, QO
return 0; return 0;
} }
QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::nativeResourceFunctionForContext(const QByteArray &resource)
{
QByteArray lowerCaseResource = resource.toLower();
if (lowerCaseResource == "get_egl_context")
return NativeResourceForContextFunction(eglContextForContext);
return 0;
}
static void *eglContextForContext(QOpenGLContext *context)
{
Q_ASSERT(context);
QEGLPlatformContext *handle = static_cast<QEGLPlatformContext *>(context->handle());
if (!handle)
return 0;
return handle->eglContext();
}
EGLConfig QEglFSIntegration::chooseConfig(EGLDisplay display, const QSurfaceFormat &format) EGLConfig QEglFSIntegration::chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
{ {
class Chooser : public QEglConfigChooser { class Chooser : public QEglConfigChooser {

View File

@ -74,6 +74,8 @@ public:
void *nativeResourceForIntegration(const QByteArray &resource); void *nativeResourceForIntegration(const QByteArray &resource);
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context); void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context);
NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) Q_DECL_OVERRIDE;
QPlatformScreen *screen() const { return mScreen; } QPlatformScreen *screen() const { return mScreen; }
static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format); static EGLConfig chooseConfig(EGLDisplay display, const QSurfaceFormat &format);