summaryrefslogtreecommitdiff
path: root/vcl/source/app
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-12-10 18:31:04 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-23 16:22:36 +0000
commit2a27d83ad8b2cab3af86624f58c183f78c2a67b8 (patch)
tree8029d92ae615e95269d3e061404dd36e6856f207 /vcl/source/app
parentad70b07e728c726e50a909d06b057072e7a0f1f3 (diff)
vcl: opengl - lean on the default window's context much more.
Avoid creating our own OpenGLContext to render until we need to refresh the screen. Also always re-use context from default window. This simplifies our OpenGL Context use significantly, and avoids problems with the initial default context getting destroyed in some cases. Change-Id: Ic2239236d3e1f14fd27979c9aab85efd84e6b760 Reviewed-on: https://gerrit.libreoffice.org/20853 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/app')
-rw-r--r--vcl/source/app/svdata.cxx19
1 files changed, 10 insertions, 9 deletions
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index edfdbc9421b8..fbde610f62f0 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -113,23 +113,25 @@ void ImplDeInitSVData()
delete pSVData->mpPaperNames, pSVData->mpPaperNames = nullptr;
}
+/// Returns either the application window, or the default GL context window
vcl::Window* ImplGetDefaultWindow()
{
ImplSVData* pSVData = ImplGetSVData();
if ( pSVData->maWinData.mpAppWin )
return pSVData->maWinData.mpAppWin;
+ else
+ return ImplGetDefaultContextWindow();
+}
- // First test if we already have a default window.
- // Don't only place a single if..else inside solar mutex lockframe
- // because then we might have to wait for the solar mutex what is not necessary
- // if we already have a default window.
+/// returns the default window created to hold the persistent VCL GL context.
+vcl::Window *ImplGetDefaultContextWindow()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ // Double check locking on mpDefaultWin.
if ( !pSVData->mpDefaultWin )
{
- Application::GetSolarMutex().acquire();
-
- // Test again because the thread who released the solar mutex could have called
- // the same method
+ SolarMutexGuard aGuard;
if ( !pSVData->mpDefaultWin && !pSVData->mbDeInit )
{
@@ -142,7 +144,6 @@ vcl::Window* ImplGetDefaultWindow()
if( pContext.is() )
pContext->acquire();
}
- Application::GetSolarMutex().release();
}
return pSVData->mpDefaultWin;