summaryrefslogtreecommitdiff
path: root/vcl/opengl
diff options
context:
space:
mode:
authorLouis-Francis Ratté-Boulianne <lfrb@collabora.com>2014-12-04 22:21:50 -0500
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-12-11 07:57:32 +0100
commit4c424d785275494835287aa3c171ee2fd5c4f884 (patch)
tree2e21e46e096e547705ef6d6057df6033807fedf3 /vcl/opengl
parent2e512773095216acbac83e6fd71f6d0444263d70 (diff)
vcl: Keep the same context for VirtualDevice to avoid FBO switches
Change-Id: I66496fae902db9df5b8301b00bb779f42adaa7a7
Diffstat (limited to 'vcl/opengl')
-rw-r--r--vcl/opengl/gdiimpl.cxx19
1 files changed, 9 insertions, 10 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 86a592952234..4edd843355c3 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -56,8 +56,8 @@ OpenGLSalGraphicsImpl::~OpenGLSalGraphicsImpl()
OpenGLContext* OpenGLSalGraphicsImpl::GetOpenGLContext()
{
- if( !mpContext )
- AcquireContext();
+ if( !AcquireContext() )
+ return NULL;
return mpContext;
}
@@ -71,7 +71,11 @@ bool OpenGLSalGraphicsImpl::AcquireContext( )
ImplSVData* pSVData = ImplGetSVData();
if( mpContext )
+ {
+ if( mpContext->isInitialized() )
+ return true;
mpContext->DeRef();
+ }
OpenGLContext* pContext = pSVData->maGDIData.mpLastContext;
@@ -122,7 +126,7 @@ void OpenGLSalGraphicsImpl::Init()
void OpenGLSalGraphicsImpl::PreDraw()
{
- if( !mpContext && !AcquireContext() )
+ if( !AcquireContext() )
{
SAL_WARN( "vcl.opengl", "Couldn't acquire context" );
return;
@@ -161,11 +165,6 @@ void OpenGLSalGraphicsImpl::PostDraw()
mpFramebuffer = NULL;
CHECK_GL_ERROR();
-
- // release the context as there is no guarantee the underlying window
- // will still be valid for the next draw operation
- if( mbOffscreen )
- ReleaseContext();
}
void OpenGLSalGraphicsImpl::freeResources()
@@ -1414,7 +1413,7 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPoly,
void OpenGLSalGraphicsImpl::beginPaint()
{
- if( !mpContext && !AcquireContext() )
+ if( !AcquireContext() )
return;
mpContext->mnPainting++;
@@ -1422,7 +1421,7 @@ void OpenGLSalGraphicsImpl::beginPaint()
void OpenGLSalGraphicsImpl::endPaint()
{
- if( !mpContext && !AcquireContext() )
+ if( !AcquireContext() )
return;
mpContext->mnPainting--;