diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2016-01-29 10:43:35 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-03-01 14:46:14 +0000 |
commit | 29d8159c4478a5275d2ea102daf270a91ed7e92e (patch) | |
tree | 709a145107cdfc58e67b4fabe6a76534d5cc7801 /src/plugins/platforms/xcb/gl_integrations | |
parent | 7ee585bbffb4350ec327116d30cd63e3d1142581 (diff) |
Avoid repeated QByteArray creation when resolving opengl functions
Add an getProcAddress(const char *) overload to QOpenGLContext,
and refactor the QPA interface to take a const char *. Like this
we can avoid lots of mallocs when resoving GL methods.
Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/plugins/platforms/xcb/gl_integrations')
-rw-r--r-- | src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index ff624d9755..4290ec54fc 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -550,10 +550,10 @@ void QGLXContext::swapBuffers(QPlatformSurface *surface) } } -void (*QGLXContext::getProcAddress(const QByteArray &procName)) () +QFunctionPointer QGLXContext::getProcAddress(const char *procName) { #ifdef QT_STATIC - return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.constData())); + return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName)); #else typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; @@ -585,7 +585,7 @@ void (*QGLXContext::getProcAddress(const QByteArray &procName)) () } if (!glXGetProcAddressARB) return 0; - return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.constData())); + return (void (*)())glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName)); #endif } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h index e5cbee3363..f00d96e6d5 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.h @@ -63,7 +63,7 @@ public: bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE; void doneCurrent() Q_DECL_OVERRIDE; void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE; - QFunctionPointer getProcAddress(const QByteArray &procName) Q_DECL_OVERRIDE; + QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE; QSurfaceFormat format() const Q_DECL_OVERRIDE; bool isSharing() const Q_DECL_OVERRIDE; |