Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qxcbglxnativeinterfacehandler.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
8#include <QtGui/QOpenGLContext>
10
11static int resourceType(const QByteArray &key)
12{
13 static const QByteArray names[] = { // match QXcbGlxNativeInterfaceHandler::ResourceType
14 QByteArrayLiteral("glxconfig"),
15 QByteArrayLiteral("glxcontext"),
16 };
17 for (size_t i = 0; i < sizeof(names) / sizeof(names[0]); i++) {
18 if (key == names[i])
19 return i;
20 }
21
22 return sizeof(names) / sizeof(names[0]);
23}
24
29
31{
32 switch (resourceType(resource)) {
33 case GLXConfig:
34 return glxConfigForContext;
35 case GLXContext:
36 return glxContextForContext;
37 default:
38 break;
39 }
40 return nullptr;
41}
42
43void *QXcbGlxNativeInterfaceHandler::glxContextForContext(QOpenGLContext *context)
44{
45 Q_ASSERT(context);
46 QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle());
47 return glxPlatformContext->glxContext();
48}
49
50void *QXcbGlxNativeInterfaceHandler::glxConfigForContext(QOpenGLContext *context)
51{
52 Q_ASSERT(context);
53 QGLXContext *glxPlatformContext = static_cast<QGLXContext *>(context->handle());
54 return glxPlatformContext->glxConfig();
55
56}
57
58QT_END_NAMESPACE
QPlatformNativeInterface::NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) const override
QXcbGlxNativeInterfaceHandler(QXcbNativeInterface *nativeInterface)
static QT_BEGIN_NAMESPACE int resourceType(const QByteArray &key)