Kaydet (Commit) 6f5a9486 authored tarafından Michael Meeks's avatar Michael Meeks

vcl: check the OpenGL drawable as well as the context.

Change-Id: Idac493dfb3239f7ae5b5e49158d79c4f3e707509
üst 620156f5
...@@ -1137,7 +1137,8 @@ SystemWindowData OpenGLContext::generateWinData(vcl::Window* pParent, bool) ...@@ -1137,7 +1137,8 @@ SystemWindowData OpenGLContext::generateWinData(vcl::Window* pParent, bool)
void OpenGLContext::makeCurrent() void OpenGLContext::makeCurrent()
{ {
#if defined( WNT ) #if defined( WNT )
if (wglGetCurrentContext() == m_aGLWin.hRC) if (wglGetCurrentContext() == m_aGLWin.hRC &&
wglGetCurrentDC() == m_aGLWin.hDC)
{ {
SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context"); SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
} }
...@@ -1151,11 +1152,13 @@ void OpenGLContext::makeCurrent() ...@@ -1151,11 +1152,13 @@ void OpenGLContext::makeCurrent()
#elif defined( IOS ) || defined( ANDROID ) #elif defined( IOS ) || defined( ANDROID )
// nothing // nothing
#elif defined( UNX ) #elif defined( UNX )
if (glXGetCurrentContext() == m_aGLWin.ctx) GLXDrawable nDrawable = mbPixmap ? m_aGLWin.glPix : m_aGLWin.win;
if (glXGetCurrentContext() == m_aGLWin.ctx &&
glXGetCurrentDrawable() == nDrawable)
{ {
SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context"); SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
} }
else if (!glXMakeCurrent( m_aGLWin.dpy, mbPixmap ? m_aGLWin.glPix : m_aGLWin.win, m_aGLWin.ctx )) else if (!glXMakeCurrent( m_aGLWin.dpy, nDrawable, m_aGLWin.ctx ))
SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed"); SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed");
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment