summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-09-16 03:25:05 +0100
committerAndras Timar <andras.timar@collabora.com>2015-09-19 21:32:19 +0200
commitfba72931db258ff3aa464932a2d75c55d340281f (patch)
tree3c8eb44bf8bf89be542fefa0b1c25e33da81ebfc
parent68b477e0ed2e2c5b59751b0b936c2b663be3c5b5 (diff)
tdf#94252 - avoid switching contexts un-necessarily to reduce flicker.
Change-Id: Id4ac387174fa03c5886a990d89fd53a4f18db11c Reviewed-on: https://gerrit.libreoffice.org/18610 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--vcl/opengl/gdiimpl.cxx9
1 files changed, 9 insertions, 0 deletions
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();