From dd0fa60f6c289d7f290577cc240deb7b6e83fc8f 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 --- vcl/opengl/gdiimpl.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vcl') diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 943e1b43fe21..c092f0317b1b 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