[plugins/qpa] Drop unused variable AbstractPlatformContext::m_integration

Credits to clang for finding unused private variable. This allowed to
similify the ctor and remove a const_cast.
This commit is contained in:
Martin Gräßlin 2017-07-31 18:09:15 +02:00
parent f5845fec02
commit e713df1886
5 changed files with 10 additions and 12 deletions

View file

@ -96,9 +96,8 @@ static QSurfaceFormat formatFromConfig(EGLDisplay dpy, EGLConfig config)
return format;
}
AbstractPlatformContext::AbstractPlatformContext(QOpenGLContext *context, Integration *integration, EGLDisplay display, EGLConfig config)
AbstractPlatformContext::AbstractPlatformContext(QOpenGLContext *context, EGLDisplay display, EGLConfig config)
: QPlatformOpenGLContext()
, m_integration(integration)
, m_eglDisplay(display)
, m_config(config ? config :configFromGLFormat(m_eglDisplay, context->format()))
, m_format(formatFromConfig(m_eglDisplay, m_config))

View file

@ -33,7 +33,7 @@ class Integration;
class AbstractPlatformContext : public QPlatformOpenGLContext
{
public:
explicit AbstractPlatformContext(QOpenGLContext *context, Integration *integration, EGLDisplay display, EGLConfig config = nullptr);
explicit AbstractPlatformContext(QOpenGLContext *context, EGLDisplay display, EGLConfig config = nullptr);
virtual ~AbstractPlatformContext();
void doneCurrent() override;
@ -55,7 +55,6 @@ protected:
void createContext(EGLContext shareContext = EGL_NO_CONTEXT);
private:
Integration *m_integration;
EGLDisplay m_eglDisplay;
EGLConfig m_config;
EGLContext m_context = EGL_NO_CONTEXT;

View file

@ -185,13 +185,13 @@ QPlatformNativeInterface *Integration::nativeInterface() const
QPlatformOpenGLContext *Integration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
if (kwinApp()->platform()->supportsQpaContext()) {
return new SharingPlatformContext(context, const_cast<Integration*>(this));
return new SharingPlatformContext(context);
}
if (kwinApp()->platform()->sceneEglDisplay() != EGL_NO_DISPLAY) {
auto s = kwinApp()->platform()->sceneEglSurface();
if (s != EGL_NO_SURFACE) {
// try a SharingPlatformContext with a created surface
return new SharingPlatformContext(context, const_cast<Integration*>(this), s, kwinApp()->platform()->sceneEglConfig());
return new SharingPlatformContext(context, s, kwinApp()->platform()->sceneEglConfig());
}
}
if (m_eglDisplay == EGL_NO_DISPLAY) {

View file

@ -33,13 +33,13 @@ namespace KWin
namespace QPA
{
SharingPlatformContext::SharingPlatformContext(QOpenGLContext *context, Integration *integration)
: SharingPlatformContext(context, integration, EGL_NO_SURFACE)
SharingPlatformContext::SharingPlatformContext(QOpenGLContext *context)
: SharingPlatformContext(context, EGL_NO_SURFACE)
{
}
SharingPlatformContext::SharingPlatformContext(QOpenGLContext *context, Integration *integration, const EGLSurface &surface, EGLConfig config)
: AbstractPlatformContext(context, integration, kwinApp()->platform()->sceneEglDisplay(), config)
SharingPlatformContext::SharingPlatformContext(QOpenGLContext *context, const EGLSurface &surface, EGLConfig config)
: AbstractPlatformContext(context, kwinApp()->platform()->sceneEglDisplay(), config)
, m_surface(surface)
{
create();

View file

@ -31,8 +31,8 @@ class Integration;
class SharingPlatformContext : public AbstractPlatformContext
{
public:
explicit SharingPlatformContext(QOpenGLContext *context, Integration *integration);
explicit SharingPlatformContext(QOpenGLContext *context, Integration *integration, const EGLSurface &surface, EGLConfig config = nullptr);
explicit SharingPlatformContext(QOpenGLContext *context);
explicit SharingPlatformContext(QOpenGLContext *context, const EGLSurface &surface, EGLConfig config = nullptr);
void swapBuffers(QPlatformSurface *surface) override;