[Libreoffice-commits] core.git: Branch 'libreoffice-5-0-2' - include/vcl vcl/inc vcl/opengl

Michael Meeks michael.meeks at collabora.com
Wed Sep 16 10:48:58 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 f4ae433fdda76dc4268de7499e1312e1737b0b64
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
    Reviewed-on: https://gerrit.libreoffice.org/18644
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 464f49e0b88e13c132bcf9cfe250239a1e1b0f8d)
    Reviewed-on: https://gerrit.libreoffice.org/18645
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 98f9c61..e706df5 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -241,6 +241,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 55f2e70..e069349 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 d452f5d..b2e047c 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 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