[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/opengl
Michael Meeks
michael.meeks at collabora.com
Wed Sep 16 08:52:38 PDT 2015
include/vcl/opengl/OpenGLContext.hxx | 5 +++++
vcl/inc/openglgdiimpl.hxx | 3 +++
vcl/opengl/gdiimpl.cxx | 7 +++++++
vcl/opengl/win/gdiimpl.cxx | 2 +-
vcl/opengl/x11/gdiimpl.cxx | 3 +--
5 files changed, 17 insertions(+), 3 deletions(-)
New commits:
commit 86fc660353e0cb73bee911f432f2f0b18de82363
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Sep 16 16:52:13 2015 +0100
tdf#94281 - don't mix legacy and VCL OpenGLContext's.
Each has rather different assumptions about how life should be.
Change-Id: I85fffc77d14f3a5335a077fcb541a2b31c372043
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index b2aaa17..e448be4 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -240,6 +240,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 e3bec44..2e17790 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 e92d864..83352ec 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1870,4 +1870,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 517cff1..cc34d67 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 65b279b..fa47b27 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
More information about the Libreoffice-commits
mailing list