Kaydet (Commit) 3afe1ed8 authored tarafından Michael Meeks's avatar Michael Meeks Kaydeden (comit) Andras Timar

tdf#94281 - don't mix legacy and VCL OpenGLContext's.

Each has rather different assumptions about how life should be.

Change-Id: I85fffc77d14f3a5335a077fcb541a2b31c372043
Reviewed-on: https://gerrit.libreoffice.org/18644Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
Tested-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 8bfe1de0
...@@ -245,6 +245,11 @@ public: ...@@ -245,6 +245,11 @@ public:
return mbInitialized; return mbInitialized;
} }
bool requestedLegacy()
{
return mbRequestLegacyContext;
}
bool supportMultiSampling() const; bool supportMultiSampling() const;
static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext); static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext);
......
...@@ -59,6 +59,9 @@ protected: ...@@ -59,6 +59,9 @@ protected:
OpenGLFramebuffer* mpFramebuffer; OpenGLFramebuffer* mpFramebuffer;
OpenGLProgram* mpProgram; OpenGLProgram* mpProgram;
/// Is it someone else's context we shouldn't be fiddling with ?
static bool IsForeignContext(const rtl::Reference<OpenGLContext> &xContext);
// clipping // clipping
vcl::Region maClipRegion; vcl::Region maClipRegion;
bool mbUseScissor; bool mbUseScissor;
......
...@@ -1881,4 +1881,11 @@ OpenGLContext *OpenGLSalGraphicsImpl::beginPaint() ...@@ -1881,4 +1881,11 @@ OpenGLContext *OpenGLSalGraphicsImpl::beginPaint()
return mpContext.get(); return mpContext.get();
} }
bool OpenGLSalGraphicsImpl::IsForeignContext(const rtl::Reference<OpenGLContext> &xContext)
{
// so far a blunt heuristic: vcl uses shiny new contexts.
return xContext->requestedLegacy();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -39,7 +39,7 @@ rtl::Reference<OpenGLContext> WinOpenGLSalGraphicsImpl::CreateWinContext() ...@@ -39,7 +39,7 @@ rtl::Reference<OpenGLContext> WinOpenGLSalGraphicsImpl::CreateWinContext()
bool WinOpenGLSalGraphicsImpl::UseContext( const rtl::Reference<OpenGLContext> &pContext ) bool WinOpenGLSalGraphicsImpl::UseContext( const rtl::Reference<OpenGLContext> &pContext )
{ {
if( !pContext.is() || !pContext->isInitialized() ) if( !pContext.is() || !pContext->isInitialized() || IsForeignContext( pContext ) )
return false; return false;
if( IsOffscreen() ) if( IsOffscreen() )
return true; return true;
......
...@@ -62,9 +62,8 @@ bool X11OpenGLSalGraphicsImpl::UseContext( const rtl::Reference<OpenGLContext> & ...@@ -62,9 +62,8 @@ bool X11OpenGLSalGraphicsImpl::UseContext( const rtl::Reference<OpenGLContext> &
{ {
X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame); X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame);
if( !pContext->isInitialized() ) if( !pContext->isInitialized() || IsForeignContext( pContext ) )
return false; return false;
if( !pProvider ) if( !pProvider )
return pContext->getOpenGLWindow().win != None; return pContext->getOpenGLWindow().win != None;
else else
......
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