From fba72931db258ff3aa464932a2d75c55d340281f Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 16 Sep 2015 03:25:05 +0100 Subject: tdf#94252 - avoid switching contexts un-necessarily to reduce flicker. Change-Id: Id4ac387174fa03c5886a990d89fd53a4f18db11c Reviewed-on: https://gerrit.libreoffice.org/18610 Tested-by: Jenkins Reviewed-by: Tor Lillqvist --- vcl/opengl/gdiimpl.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 37b21f36edc1..9ea8a7c87fc8 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(); -- cgit