diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2014-12-02 06:54:27 +0000 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-12-02 11:58:47 +0100 |
commit | aefeef36fdd536bfc8b1038e14d552db8c60c70d (patch) | |
tree | 5455ae4ee3a104504859083c75a5f92950fefb40 | |
parent | 44b6f1cbdc821765ef4f889f0e6a558b44100407 (diff) |
vcl: use resetToReInitialize to avoid context problems on Windows.
It appears that we have to do this for VirtualDevices, where we have
freed / re-allocated the underlying resource, or we fail to switch the
current context, and render to the wrong place, before blatting a
blank texture over the top of it.
Change-Id: I0253f216ea7dc9786374dc83ca38f4f6295e3035
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 9 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLContext.cxx | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 462a479ba04e..46d72dc6854b 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -105,6 +105,15 @@ 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/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 95b39401fb2c..41eae3ba61b0 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -621,6 +621,17 @@ 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) { |