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

Michael Meeks michael.meeks at collabora.com
Tue Sep 15 19:16:01 PDT 2015


 vcl/opengl/gdiimpl.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit dd0fa60f6c289d7f290577cc240deb7b6e83fc8f
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Sep 16 03:25:05 2015 +0100

    tdf#94252 - avoid switching contexts un-necessarily to reduce flicker.
    
    Change-Id: Id4ac387174fa03c5886a990d89fd53a4f18db11c

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 943e1b4..c092f03 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -77,8 +77,17 @@ bool OpenGLSalGraphicsImpl::AcquireContext( )
 {
     ImplSVData* pSVData = ImplGetSVData();
 
+    // We always prefer to bind our VirtualDevice / offscreen graphics
+    // to the current OpenGLContext - to avoid switching contexts.
+    if (mpContext.is() && mbOffscreen)
+    {
+        if (OpenGLContext::hasCurrent() && !mpContext->isCurrent())
+            mpContext.clear();
+    }
+
     if( mpContext.is() )
     {
+        // Check whether the context was reset underneath us.
         if( mpContext->isInitialized() )
             return true;
         mpContext.clear();


More information about the Libreoffice-commits mailing list