summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();