[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/opengl vcl/source

Michael Meeks michael.meeks at collabora.com
Fri Dec 11 12:39:46 PST 2015


 include/vcl/opengl/OpenGLContext.hxx |    5 +++++
 vcl/inc/openglgdiimpl.hxx            |    5 +----
 vcl/opengl/gdiimpl.cxx               |    7 -------
 vcl/opengl/win/gdiimpl.cxx           |    1 +
 vcl/opengl/x11/gdiimpl.cxx           |    1 +
 vcl/source/opengl/OpenGLContext.cxx  |    1 +
 6 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 6c68b71058263be74197a961fd7dfd2b43caf22d
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Dec 11 18:18:50 2015 +0000

    vcl: use a custom tag for VCL OpenGLContext's to avoid re-use.
    
    Other code is out of legacy mode now, so can't legacy as a proxy.
    
    Change-Id: Ie3807a3af680b707f2f08d058db955bc9cae6c2b
    Reviewed-on: https://gerrit.libreoffice.org/20647
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 36efe03..52ef5d0 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -200,6 +200,10 @@ public:
         return mbRequestLegacyContext;
     }
 
+    /// VCL promiscuously re-uses its own contexts:
+    void setVCLOnly() { mbVCLOnly = true; }
+    bool isVCLOnly() { return mbVCLOnly; }
+
     bool supportMultiSampling() const;
 
     static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext);
@@ -225,6 +229,7 @@ private:
     int  mnRefCount;
     bool mbRequestLegacyContext;
     bool mbUseDoubleBufferedRendering;
+    bool mbVCLOnly;
 
     int mnFramebufferCount;
     OpenGLFramebuffer* mpCurrentFramebuffer;
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index a3899de..fc95071 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -72,9 +72,6 @@ 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);
-
     /// This idle handler is used to swap buffers after rendering.
     OpenGLFlushIdle *mpFlush;
 
@@ -174,7 +171,7 @@ protected:
     static bool UseContext( const rtl::Reference<OpenGLContext> &pContext )
     {
         return pContext->isInitialized() &&  // not released by the OS etc.
-               IsForeignContext( pContext ); // a genuine VCL context.
+               pContext->isVCLOnly();
     }
 
 public:
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 16bb72a..0b6dc76 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -2092,11 +2092,4 @@ void OpenGLSalGraphicsImpl::doFlush()
     VCL_GL_INFO( "flushAndSwap - end." );
 }
 
-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 666cdbf..9ca266a6 100644
--- a/vcl/opengl/win/gdiimpl.cxx
+++ b/vcl/opengl/win/gdiimpl.cxx
@@ -29,6 +29,7 @@ void WinOpenGLSalGraphicsImpl::copyBits( const SalTwoRect& rPosAry, SalGraphics*
 rtl::Reference<OpenGLContext> WinOpenGLSalGraphicsImpl::CreateWinContext()
 {
     rtl::Reference<OpenGLContext> pContext = OpenGLContext::Create();
+    pContext->setVCLOnly();
     pContext->init( mrParent.mhLocalDC, mrParent.mhWnd );
     return pContext;
 }
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 595ca45c..effc81b 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -53,6 +53,7 @@ rtl::Reference<OpenGLContext> X11OpenGLSalGraphicsImpl::CreateWinContext()
 
     Window aWin = pProvider->GetX11Window();
     rtl::Reference<OpenGLContext> pContext = OpenGLContext::Create();
+    pContext->setVCLOnly();
     pContext->init( mrParent.GetXDisplay(), aWin,
                     mrParent.m_nXScreen.getXScreen() );
     return pContext;
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 98be555..b4d53ea 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -63,6 +63,7 @@ OpenGLContext::OpenGLContext():
     mnRefCount(0),
     mbRequestLegacyContext(false),
     mbUseDoubleBufferedRendering(true),
+    mbVCLOnly(false),
     mnFramebufferCount(0),
     mpCurrentFramebuffer(nullptr),
     mpFirstFramebuffer(nullptr),


More information about the Libreoffice-commits mailing list