[Libreoffice-commits] core.git: chart2/source include/vcl vcl/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Sat Jul 12 23:02:05 PDT 2014
chart2/source/view/charttypes/GL3DBarChart.cxx | 4 ++++
include/vcl/opengl/OpenGLContext.hxx | 1 +
vcl/source/opengl/OpenGLContext.cxx | 11 +++++++++++
3 files changed, 16 insertions(+)
New commits:
commit dde00f1f8ac598314b7f8a787eeacc841bc65f1c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sun Jul 13 07:52:51 2014 +0200
make threaded rendering work correctly, fdo#81110
The context may only be bound in one thread!
Change-Id: Ibb67f88c2f11fd48884ee39d89620193e4e5471b
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 8ce235f..540615b 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -407,6 +407,7 @@ void GL3DBarChart::update()
Size aSize = mrWindow.GetSizePixel();
mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderOneFrameThread(this));
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
}
@@ -441,6 +442,7 @@ void GL3DBarChart::moveToDefault()
Size aSize = mrWindow.GetSizePixel();
mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maDefaultCameraPosition, STEPS));
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
/*
@@ -498,6 +500,7 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
Size aSize = mrWindow.GetSizePixel();
mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maTargetPosition, STEPS));
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
/*
@@ -579,6 +582,7 @@ void GL3DBarChart::moveToCorner()
mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, getCornerPosition(mnCornerId),
maCameraPosition, STEPS));
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
// TODO: moggi: add to thread
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 1e6f13e..94c70f3 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -151,6 +151,7 @@ public:
bool init(SystemChildWindow* pChildWindow);
void makeCurrent();
+ void resetCurrent();
void swapBuffers();
void sync();
void show();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 48eb267..dedd5b4 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -800,6 +800,17 @@ void OpenGLContext::makeCurrent()
#endif
}
+void OpenGLContext::resetCurrent()
+{
+#if defined( WNT )
+ wglMakeCurrent( m_aGLWin.hDC, 0 );
+#elif defined( MACOSX ) || defined( IOS ) || defined( ANDROID )
+ // nothing
+#elif defined( UNX )
+ glXMakeCurrent(m_aGLWin.dpy, None, NULL);
+#endif
+}
+
void OpenGLContext::swapBuffers()
{
#if defined( WNT )
More information about the Libreoffice-commits
mailing list