diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-09-16 16:52:13 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-09-18 10:10:57 +0200 |
commit | 3afe1ed86c1fd649a43193729dce2633d8655b4d (patch) | |
tree | e94e62acba10d47690cb05abbd033df4ec64beb8 | |
parent | 8bfe1de098b3f45efe5bf3fc1d6f524877463927 (diff) |
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/18644
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 5 | ||||
-rw-r--r-- | vcl/inc/openglgdiimpl.hxx | 3 | ||||
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 7 | ||||
-rw-r--r-- | vcl/opengl/win/gdiimpl.cxx | 2 | ||||
-rw-r--r-- | vcl/opengl/x11/gdiimpl.cxx | 3 |
5 files changed, 17 insertions, 3 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 3e91f6f61a2c..68d7209f6662 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -245,6 +245,11 @@ public: return mbInitialized; } + bool requestedLegacy() + { + return mbRequestLegacyContext; + } + bool supportMultiSampling() const; static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext); diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx index 55f2e7039471..e0693495fd53 100644 --- a/vcl/inc/openglgdiimpl.hxx +++ b/vcl/inc/openglgdiimpl.hxx @@ -59,6 +59,9 @@ protected: OpenGLFramebuffer* mpFramebuffer; OpenGLProgram* mpProgram; + /// Is it someone else's context we shouldn't be fiddling with ? + static bool IsForeignContext(const rtl::Reference<OpenGLContext> &xContext); + // clipping vcl::Region maClipRegion; bool mbUseScissor; diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index d452f5d18cd8..b2e047c2943f 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -1881,4 +1881,11 @@ OpenGLContext *OpenGLSalGraphicsImpl::beginPaint() 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: */ diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index 517cff1b853f..cc34d670209f 100644 --- a/vcl/opengl/win/gdiimpl.cxx +++ b/vcl/opengl/win/gdiimpl.cxx @@ -39,7 +39,7 @@ rtl::Reference<OpenGLContext> WinOpenGLSalGraphicsImpl::CreateWinContext() bool WinOpenGLSalGraphicsImpl::UseContext( const rtl::Reference<OpenGLContext> &pContext ) { - if( !pContext.is() || !pContext->isInitialized() ) + if( !pContext.is() || !pContext->isInitialized() || IsForeignContext( pContext ) ) return false; if( IsOffscreen() ) return true; diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index 65b279b43f11..fa47b271aec4 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -62,9 +62,8 @@ bool X11OpenGLSalGraphicsImpl::UseContext( const rtl::Reference<OpenGLContext> & { X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame); - if( !pContext->isInitialized() ) + if( !pContext->isInitialized() || IsForeignContext( pContext ) ) return false; - if( !pProvider ) return pContext->getOpenGLWindow().win != None; else |