Kaydet (Commit) cca7884f authored tarafından Michael Meeks's avatar Michael Meeks Kaydeden (comit) Andras Timar

tdf#93839 - Encourage vdevs to pick up new GL Contexts when they go invalid.

Change-Id: I21726d0dd052fdc87e8dd36ff7122518325f6313
Reviewed-on: https://gerrit.libreoffice.org/18242Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
Tested-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 501019f0
...@@ -154,6 +154,8 @@ public: ...@@ -154,6 +154,8 @@ public:
virtual void Init() SAL_OVERRIDE; virtual void Init() SAL_OVERRIDE;
virtual void DeInit() SAL_OVERRIDE;
virtual void freeResources() SAL_OVERRIDE; virtual void freeResources() SAL_OVERRIDE;
const vcl::Region& getClipRegion() const; const vcl::Region& getClipRegion() const;
......
...@@ -46,6 +46,8 @@ public: ...@@ -46,6 +46,8 @@ public:
virtual void Init() = 0; virtual void Init() = 0;
virtual void DeInit() {}
virtual void freeResources() = 0; virtual void freeResources() = 0;
virtual bool setClipRegion( const vcl::Region& ) = 0; virtual bool setClipRegion( const vcl::Region& ) = 0;
......
...@@ -149,6 +149,19 @@ void OpenGLSalGraphicsImpl::Init() ...@@ -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() void OpenGLSalGraphicsImpl::PreDraw()
{ {
OpenGLZone::enter(); OpenGLZone::enter();
......
...@@ -1253,6 +1253,9 @@ void OpenGLContext::reset() ...@@ -1253,6 +1253,9 @@ void OpenGLContext::reset()
OpenGLZone aZone; OpenGLZone aZone;
// don't reset a context in the middle of stack frames rendering to it
assert( mnPainting == 0 );
// reset the clip region // reset the clip region
maClipRegion.SetEmpty(); maClipRegion.SetEmpty();
......
...@@ -502,6 +502,8 @@ void WinSalGraphics::DeInitGraphics() ...@@ -502,6 +502,8 @@ void WinSalGraphics::DeInitGraphics()
SelectBrush( getHDC(), mhDefBrush ); SelectBrush( getHDC(), mhDefBrush );
if ( mhDefFont ) if ( mhDefFont )
SelectFont( getHDC(), mhDefFont ); SelectFont( getHDC(), mhDefFont );
mpImpl->DeInit();
} }
HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp ) HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
......
...@@ -181,7 +181,7 @@ WinSalVirtualDevice::~WinSalVirtualDevice() ...@@ -181,7 +181,7 @@ WinSalVirtualDevice::~WinSalVirtualDevice()
// destroy saved DC // destroy saved DC
if( mpGraphics->getDefPal() ) if( mpGraphics->getDefPal() )
SelectPalette( mpGraphics->getHDC(), mpGraphics->getDefPal(), TRUE ); SelectPalette( mpGraphics->getHDC(), mpGraphics->getDefPal(), TRUE );
mpGraphics->InitGraphics(); mpGraphics->DeInitGraphics();
if( mhDefBmp ) if( mhDefBmp )
SelectBitmap( mpGraphics->getHDC(), mhDefBmp ); SelectBitmap( mpGraphics->getHDC(), mhDefBmp );
if( !mbForeignDC ) if( !mbForeignDC )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment