diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2014-12-02 09:05:19 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-12-03 14:41:17 +0100 |
commit | b1cfad5e8b38fc02de498993cf46e2404ced1058 (patch) | |
tree | 5c21e22e18fbea007462c68cba5ef7757c3fd283 /vcl/opengl | |
parent | 3bde660f7c0d3fca42b1a431c644cf86d2c5ade8 (diff) |
vcl: Don't create new contexts for Virtual Devices on Windows
Change-Id: I561a8142f986aca89e796ce2c4a0902fae41f9e6
Diffstat (limited to 'vcl/opengl')
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 16 | ||||
-rw-r--r-- | vcl/opengl/win/gdiimpl.cxx | 11 | ||||
-rw-r--r-- | vcl/opengl/x11/gdiimpl.cxx | 10 |
3 files changed, 8 insertions, 29 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 970957cf1555..e836e821f82f 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -61,6 +61,11 @@ OpenGLContext* OpenGLSalGraphicsImpl::GetOpenGLContext() return mpContext; } +OpenGLContext* OpenGLSalGraphicsImpl::GetDefaultContext() +{ + return ImplGetDefaultWindow()->GetGraphics()->GetOpenGLContext(); +} + bool OpenGLSalGraphicsImpl::AcquireContext( ) { ImplSVData* pSVData = ImplGetSVData(); @@ -81,7 +86,7 @@ bool OpenGLSalGraphicsImpl::AcquireContext( ) if( pContext ) pContext->AddRef(); else - pContext = mbOffscreen ? CreatePixmapContext() : CreateWinContext(); + pContext = mbOffscreen ? GetDefaultContext() : CreateWinContext(); mpContext = pContext; return (mpContext != NULL); @@ -112,15 +117,6 @@ void OpenGLSalGraphicsImpl::Init() maOffscreenTex.GetHeight() != GetHeight() ) { maOffscreenTex = OpenGLTexture(); -#if defined(WNT) - // URGH ... VirtualDevice may have destroyed the underlying resource - // our context is associated with - FIXME: can we do better here ? - if (mpContext) - { - mpContext->resetToReInitialize(); - ReleaseContext(); - } -#endif } } diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index 939d4e0a1c50..a56ea3063b14 100644 --- a/vcl/opengl/win/gdiimpl.cxx +++ b/vcl/opengl/win/gdiimpl.cxx @@ -38,16 +38,9 @@ bool WinOpenGLSalGraphicsImpl::UseContext( OpenGLContext* pContext ) { if( !pContext || !pContext->isInitialized() ) return false; + if( IsOffscreen() ) + return true; return ( pContext->getOpenGLWindow().hWnd == mrParent.mhWnd ); } -OpenGLContext* WinOpenGLSalGraphicsImpl::CreatePixmapContext() -{ - OpenGLContext* pContext = new OpenGLContext(); - pContext->requestVirtualDevice(); - pContext->requestSingleBufferedRendering(); - pContext->init( mrParent.mhLocalDC, mrParent.mhWnd ); - return pContext; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index e5070d7b02c7..d0d890b97fc6 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -56,16 +56,6 @@ OpenGLContext* X11OpenGLSalGraphicsImpl::CreateWinContext() return pContext; } -OpenGLContext* X11OpenGLSalGraphicsImpl::CreatePixmapContext() -{ - X11OpenGLSalVirtualDevice* pVDev = dynamic_cast<X11OpenGLSalVirtualDevice*>(mrParent.m_pVDev); - - if( pVDev == NULL ) - return NULL; - - return ImplGetDefaultWindow()->GetGraphics()->GetOpenGLContext(); -} - bool X11OpenGLSalGraphicsImpl::UseContext( OpenGLContext* pContext ) { X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame); |