[Libreoffice-commits] core.git: vcl/inc vcl/opengl vcl/source vcl/win
Michael Meeks
michael.meeks at collabora.com
Tue Sep 1 07:07:21 PDT 2015
vcl/inc/openglgdiimpl.hxx | 2 ++
vcl/inc/salgdiimpl.hxx | 2 ++
vcl/opengl/gdiimpl.cxx | 13 +++++++++++++
vcl/source/opengl/OpenGLContext.cxx | 3 +++
vcl/win/source/gdi/salgdi.cxx | 2 ++
vcl/win/source/gdi/salvd.cxx | 2 +-
6 files changed, 23 insertions(+), 1 deletion(-)
New commits:
commit 6a12aecf6f7791f00894b08bb394ee0139e10d6f
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue Sep 1 15:09:25 2015 +0100
tdf#93839 - Encourage vdevs to pick up new GL Contexts when they go invalid.
Change-Id: I21726d0dd052fdc87e8dd36ff7122518325f6313
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index c95453e..62a51e1 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -153,6 +153,8 @@ public:
virtual void Init() SAL_OVERRIDE;
+ virtual void DeInit() SAL_OVERRIDE;
+
virtual void freeResources() SAL_OVERRIDE;
const vcl::Region& getClipRegion() const;
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index 237f60b..15dd11b 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -46,6 +46,8 @@ public:
virtual void Init() = 0;
+ virtual void DeInit() {}
+
virtual void freeResources() = 0;
virtual bool setClipRegion( const vcl::Region& ) = 0;
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index c16b93b..a1508f3 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -149,6 +149,19 @@ void OpenGLSalGraphicsImpl::Init()
}
}
+// Currently only used to get windows ordering right.
+void OpenGLSalGraphicsImpl::DeInit()
+{
+ // tdf#93839:
+ // Our window handles and resources are being free underneath us.
+ // These can be bound into a context, which relies on them. So
+ // let it know. Other eg. VirtualDevice contexts which have
+ // references on and rely on this context continuing to work will
+ // get a shiny new context in AcquireContext:: next PreDraw.
+ if( mpContext && !IsOffscreen() )
+ mpContext->reset();
+}
+
void OpenGLSalGraphicsImpl::PreDraw()
{
OpenGLZone::enter();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d20d6fd..91ebb75 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1165,6 +1165,9 @@ void OpenGLContext::reset()
OpenGLZone aZone;
+ // don't reset a context in the middle of stack frames rendering to it
+ assert( mnPainting == 0 );
+
// reset the clip region
maClipRegion.SetEmpty();
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index cf77cf1..58c0f7e 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -497,6 +497,8 @@ void WinSalGraphics::DeInitGraphics()
SelectBrush( getHDC(), mhDefBrush );
if ( mhDefFont )
SelectFont( getHDC(), mhDefFont );
+
+ mpImpl->DeInit();
}
HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
index ac01d92..2a492b8 100644
--- a/vcl/win/source/gdi/salvd.cxx
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -181,7 +181,7 @@ WinSalVirtualDevice::~WinSalVirtualDevice()
// destroy saved DC
if( mpGraphics->getDefPal() )
SelectPalette( mpGraphics->getHDC(), mpGraphics->getDefPal(), TRUE );
- mpGraphics->InitGraphics();
+ mpGraphics->DeInitGraphics();
if( mhDefBmp )
SelectBitmap( mpGraphics->getHDC(), mhDefBmp );
if( !mbForeignDC )
More information about the Libreoffice-commits
mailing list