summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis-Francis Ratté-Boulianne <lfrb@collabora.com>2014-12-02 09:05:19 -0500
committerJan Holesovsky <kendy@collabora.com>2014-12-03 14:41:17 +0100
commitb1cfad5e8b38fc02de498993cf46e2404ced1058 (patch)
tree5c21e22e18fbea007462c68cba5ef7757c3fd283
parent3bde660f7c0d3fca42b1a431c644cf86d2c5ade8 (diff)
vcl: Don't create new contexts for Virtual Devices on Windows
Change-Id: I561a8142f986aca89e796ce2c4a0902fae41f9e6
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx2
-rw-r--r--vcl/inc/opengl/win/gdiimpl.hxx1
-rw-r--r--vcl/inc/opengl/x11/gdiimpl.hxx1
-rw-r--r--vcl/inc/openglgdiimpl.hxx6
-rw-r--r--vcl/opengl/gdiimpl.cxx16
-rw-r--r--vcl/opengl/win/gdiimpl.cxx11
-rw-r--r--vcl/opengl/x11/gdiimpl.cxx10
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx11
8 files changed, 11 insertions, 47 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 595a2aeaabac..a78972cf6a5f 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -238,8 +238,6 @@ public:
return mbInitialized;
}
- void resetToReInitialize();
-
bool supportMultiSampling() const;
static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext);
diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx
index 30ade233b543..03007c9ad188 100644
--- a/vcl/inc/opengl/win/gdiimpl.hxx
+++ b/vcl/inc/opengl/win/gdiimpl.hxx
@@ -30,7 +30,6 @@ public:
protected:
virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE;
virtual bool UseContext( OpenGLContext* pContext ) SAL_OVERRIDE;
- virtual OpenGLContext* CreatePixmapContext() SAL_OVERRIDE;
public:
virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) SAL_OVERRIDE;
diff --git a/vcl/inc/opengl/x11/gdiimpl.hxx b/vcl/inc/opengl/x11/gdiimpl.hxx
index d6ef0101920b..feb3961a5e71 100644
--- a/vcl/inc/opengl/x11/gdiimpl.hxx
+++ b/vcl/inc/opengl/x11/gdiimpl.hxx
@@ -27,7 +27,6 @@ public:
protected:
virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE;
- virtual OpenGLContext* CreatePixmapContext() SAL_OVERRIDE;
virtual bool UseContext( OpenGLContext* pContext ) SAL_OVERRIDE;
public:
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index d328ab724b2f..03d1c239b0d6 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -110,12 +110,12 @@ protected:
bool AcquireContext();
bool ReleaseContext();
+ // retrieve the default context for offscreen rendering
+ virtual OpenGLContext* GetDefaultContext();
+
// create a new context for window rendering
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
virtual bool UseContext( OpenGLContext* pContext ) = 0;
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);
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 01b74b9f6900..16db85f9d9ef 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -634,17 +634,6 @@ bool OpenGLContext::init(SystemChildWindow* pChildWindow)
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
bool OpenGLContext::init(Display* dpy, Window win, int screen)
{