Kaydet (Commit) 0a04ceca authored tarafından Louis-Francis Ratté-Boulianne's avatar Louis-Francis Ratté-Boulianne Kaydeden (comit) Jan Holesovsky

vcl: Don't create new contexts for Virtual Devices on Windows

Change-Id: I561a8142f986aca89e796ce2c4a0902fae41f9e6
üst d8a8ff81
...@@ -238,8 +238,6 @@ public: ...@@ -238,8 +238,6 @@ public:
return mbInitialized; return mbInitialized;
} }
void resetToReInitialize();
bool supportMultiSampling() const; bool supportMultiSampling() const;
static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext); static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext);
......
...@@ -30,7 +30,6 @@ public: ...@@ -30,7 +30,6 @@ public:
protected: protected:
virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE; virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE;
virtual bool UseContext( OpenGLContext* pContext ) SAL_OVERRIDE; virtual bool UseContext( OpenGLContext* pContext ) SAL_OVERRIDE;
virtual OpenGLContext* CreatePixmapContext() SAL_OVERRIDE;
public: public:
virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) SAL_OVERRIDE; virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) SAL_OVERRIDE;
......
...@@ -27,7 +27,6 @@ public: ...@@ -27,7 +27,6 @@ public:
protected: protected:
virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE; virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE;
virtual OpenGLContext* CreatePixmapContext() SAL_OVERRIDE;
virtual bool UseContext( OpenGLContext* pContext ) SAL_OVERRIDE; virtual bool UseContext( OpenGLContext* pContext ) SAL_OVERRIDE;
public: public:
......
...@@ -110,12 +110,12 @@ protected: ...@@ -110,12 +110,12 @@ protected:
bool AcquireContext(); bool AcquireContext();
bool ReleaseContext(); bool ReleaseContext();
// retrieve the default context for offscreen rendering
virtual OpenGLContext* GetDefaultContext();
// create a new context for window rendering // create a new context for window rendering
virtual OpenGLContext* CreateWinContext() = 0; virtual OpenGLContext* CreateWinContext() = 0;
// create a new context for offscreen rendering
virtual OpenGLContext* CreatePixmapContext() = 0;
// check whether the given context can be used by this instance // check whether the given context can be used by this instance
virtual bool UseContext( OpenGLContext* pContext ) = 0; virtual bool UseContext( OpenGLContext* pContext ) = 0;
......
...@@ -61,6 +61,11 @@ OpenGLContext* OpenGLSalGraphicsImpl::GetOpenGLContext() ...@@ -61,6 +61,11 @@ OpenGLContext* OpenGLSalGraphicsImpl::GetOpenGLContext()
return mpContext; return mpContext;
} }
OpenGLContext* OpenGLSalGraphicsImpl::GetDefaultContext()
{
return ImplGetDefaultWindow()->GetGraphics()->GetOpenGLContext();
}
bool OpenGLSalGraphicsImpl::AcquireContext( ) bool OpenGLSalGraphicsImpl::AcquireContext( )
{ {
ImplSVData* pSVData = ImplGetSVData(); ImplSVData* pSVData = ImplGetSVData();
...@@ -81,7 +86,7 @@ bool OpenGLSalGraphicsImpl::AcquireContext( ) ...@@ -81,7 +86,7 @@ bool OpenGLSalGraphicsImpl::AcquireContext( )
if( pContext ) if( pContext )
pContext->AddRef(); pContext->AddRef();
else else
pContext = mbOffscreen ? CreatePixmapContext() : CreateWinContext(); pContext = mbOffscreen ? GetDefaultContext() : CreateWinContext();
mpContext = pContext; mpContext = pContext;
return (mpContext != NULL); return (mpContext != NULL);
...@@ -112,15 +117,6 @@ void OpenGLSalGraphicsImpl::Init() ...@@ -112,15 +117,6 @@ void OpenGLSalGraphicsImpl::Init()
maOffscreenTex.GetHeight() != GetHeight() ) maOffscreenTex.GetHeight() != GetHeight() )
{ {
maOffscreenTex = OpenGLTexture(); 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
} }
} }
......
...@@ -38,16 +38,9 @@ bool WinOpenGLSalGraphicsImpl::UseContext( OpenGLContext* pContext ) ...@@ -38,16 +38,9 @@ bool WinOpenGLSalGraphicsImpl::UseContext( OpenGLContext* pContext )
{ {
if( !pContext || !pContext->isInitialized() ) if( !pContext || !pContext->isInitialized() )
return false; return false;
if( IsOffscreen() )
return true;
return ( pContext->getOpenGLWindow().hWnd == mrParent.mhWnd ); 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -56,16 +56,6 @@ OpenGLContext* X11OpenGLSalGraphicsImpl::CreateWinContext() ...@@ -56,16 +56,6 @@ OpenGLContext* X11OpenGLSalGraphicsImpl::CreateWinContext()
return pContext; 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 ) bool X11OpenGLSalGraphicsImpl::UseContext( OpenGLContext* pContext )
{ {
X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame); X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame);
......
...@@ -633,17 +633,6 @@ bool OpenGLContext::init(SystemChildWindow* pChildWindow) ...@@ -633,17 +633,6 @@ bool OpenGLContext::init(SystemChildWindow* pChildWindow)
return ImplInit(); return ImplInit();
} }
#if defined( WNT )
// FIXME share resetToReInitialize() across platforms...
void OpenGLContext::resetToReInitialize()
{
if( !mbInitialized )
return;
resetCurrent();
mbInitialized = false;
}
#endif
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
bool OpenGLContext::init(Display* dpy, Window win, int screen) bool OpenGLContext::init(Display* dpy, Window win, int screen)
{ {
......
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