summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-12-02 06:54:27 +0000
committerJan Holesovsky <kendy@collabora.com>2014-12-02 11:58:47 +0100
commitaefeef36fdd536bfc8b1038e14d552db8c60c70d (patch)
tree5455ae4ee3a104504859083c75a5f92950fefb40
parent44b6f1cbdc821765ef4f889f0e6a558b44100407 (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.cxx9
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx11
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)
{