summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-09-16 16:52:13 +0100
committerAndras Timar <andras.timar@collabora.com>2015-09-19 21:32:21 +0200
commit9d5e8092618c94918d90bf62374a14d087d4818f (patch)
tree76e4a93fb0d03a14dae464dc8db0ca170e43e816
parent535777532e4980af6ff3ae3cb15eff786fb6eff2 (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.hxx5
-rw-r--r--vcl/inc/openglgdiimpl.hxx3
-rw-r--r--vcl/opengl/gdiimpl.cxx7
-rw-r--r--vcl/opengl/win/gdiimpl.cxx2
-rw-r--r--vcl/opengl/x11/gdiimpl.cxx3
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