vcl/inc/opengl/win/gdiimpl.hxx | 1 + vcl/opengl/gdiimpl.cxx | 9 +++++++-- vcl/opengl/win/gdiimpl.cxx | 18 +++++++++++++++++- vcl/source/opengl/OpenGLContext.cxx | 3 +++ vcl/source/window/event.cxx | 10 +++++++++- vcl/source/window/status.cxx | 6 ++++++ vcl/win/source/window/salframe.cxx | 2 +- 7 files changed, 44 insertions(+), 5 deletions(-)
New commits: commit 13651ec90278b0b80e8458e554927abc290ec55d Author: Michael Meeks <[email protected]> Date: Tue Sep 15 23:42:52 2015 +0100 tdf#94213 - calc re-size flicker turns out to be the status bar. Using vdev's associated with old contexts, is un-necessary and a recipe for context switching & hence flicker. Change-Id: I37ed967a7816e5ca0240908ab4793ce1e68570ee diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx index 852cc0c..35c3e38 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -21,6 +21,7 @@ #include <vcl/window.hxx> #include <vcl/dockwin.hxx> #include <vcl/layout.hxx> +#include <vcl/opengl/OpenGLWrapper.hxx> #include <window.h> #include <svdata.hxx> @@ -453,7 +454,14 @@ void Window::ImplCallResize() { mpWindowImpl->mbCallResize = false; - if( GetBackground().IsGradient() ) + // OpenGL has a charming feature of black clearing the whole window + // some legacy code eg. the app-menu has the beautiful feature of + // avoiding re-paints when width doesn't change => invalidate all. + if( OpenGLWrapper::isVCLOpenGLEnabled() ) + Invalidate(); + + // Normally we avoid blanking on re-size unless people might notice: + else if( GetBackground().IsGradient() ) Invalidate(); Resize(); diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index e8e2aaf..76c2de3 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -27,6 +27,7 @@ #include <vcl/status.hxx> #include <vcl/virdev.hxx> #include <vcl/settings.hxx> +#include <vcl/opengl/OpenGLWrapper.hxx> #include <svdata.hxx> #include <window.h> @@ -731,6 +732,11 @@ void StatusBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) // Do offscreen only when we are not recording layout.. bool bOffscreen = !rRenderContext.ImplIsRecordLayout(); + // tdf#94213 - un-necessary virtual-device in GL mode + // causes context switch & hence flicker during sizing. + if( OpenGLWrapper::isVCLOpenGLEnabled() ) + bOffscreen = false; + for (sal_uInt16 i = 0; i < nItemCount; i++) { ImplDrawItem(rRenderContext, bOffscreen, i, true, true); commit ae9723bc7ff4515ef5206f72a9eb2c18829cb42b Author: Michael Meeks <[email protected]> Date: Tue Sep 15 14:07:27 2015 +0100 tdf#94213 - release offscreen texture properly on re-size. We need to ensure that we use an initialized context, and that (when we re-parent) we DeInit and so reset the previous OpenGLContext. Make UseContext more paranoid as well for good measure. Change-Id: Ia45334222045e5d2f48da47560fab8511223a9a5 diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx index 04bb151..5c91727 100644 --- a/vcl/inc/opengl/win/gdiimpl.hxx +++ b/vcl/inc/opengl/win/gdiimpl.hxx @@ -34,6 +34,7 @@ protected: virtual bool UseContext( const rtl::Reference<OpenGLContext> &pContext ) SAL_OVERRIDE; public: + virtual void Init() SAL_OVERRIDE; virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) SAL_OVERRIDE; diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 10b5c35..4e29a7e 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -115,7 +115,8 @@ void OpenGLSalGraphicsImpl::Init() // check if we can simply re-use the same context if( mpContext.is() ) { - if( !UseContext( mpContext ) ) + if( !mpContext->isInitialized() || + !UseContext( mpContext ) ) ReleaseContext(); } @@ -124,8 +125,12 @@ void OpenGLSalGraphicsImpl::Init() maOffscreenTex.GetWidth() != GetWidth() || maOffscreenTex.GetHeight() != GetHeight() ) { - if( mpContext.is() ) // valid context + if( maOffscreenTex && // don't work to release empty textures + mpContext.is() ) // valid context + { + mpContext->makeCurrent(); mpContext->ReleaseFramebuffer( maOffscreenTex ); + } maOffscreenTex = OpenGLTexture(); } } diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index 30088a9..3ba2694 100644 --- a/vcl/opengl/win/gdiimpl.cxx +++ b/vcl/opengl/win/gdiimpl.cxx @@ -43,7 +43,23 @@ bool WinOpenGLSalGraphicsImpl::UseContext( const rtl::Reference<OpenGLContext> & return false; if( IsOffscreen() ) return true; - return pContext->getOpenGLWindow().hWnd == mrParent.mhWnd; + return pContext->getOpenGLWindow().hWnd == mrParent.mhWnd && + pContext->getOpenGLWindow().hDC == mrParent.mhLocalDC; +} + +void WinOpenGLSalGraphicsImpl::Init() +{ + if ( !IsOffscreen() && mpContext.is() && mpContext->isInitialized() && + ( mpContext->getOpenGLWindow().hWnd != mrParent.mhWnd || + mpContext->getOpenGLWindow().hDC == mrParent.mhLocalDC ) ) + { + // This can legitimiately happen, SalFrame keeps 2x + // SalGraphics which share the same hWnd and hDC. + // The shape 'Area' dialog does reparenting to trigger this. + SAL_WARN("vcl.opengl", "Unusual: Windows handle / DC changed without DeInit"); + } + + OpenGLSalGraphicsImpl::Init(); } namespace diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index e14e013..240cbaa 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -1681,6 +1681,9 @@ void OpenGLContext::ReleaseFramebuffer( const OpenGLTexture& rTexture ) { OpenGLZone aZone; + if (!rTexture) // no texture to release. + return; + OpenGLFramebuffer* pFramebuffer = mpLastFramebuffer; while( pFramebuffer ) diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index f8e0b69..86f72a9 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -1498,7 +1498,7 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs { if ( pThis->mpGraphics->getDefPal() ) SelectPalette( pThis->mpGraphics->getHDC(), pThis->mpGraphics->getDefPal(), TRUE ); - pThis->mpGraphics->InitGraphics(); + pThis->mpGraphics->DeInitGraphics(); ReleaseDC( pThis->mhWnd, pThis->mpGraphics->getHDC() ); } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
