summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-07 04:16:54 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-07 21:23:04 +0200
commit67c134d4e26fca9317157f634bed1fff6a3093e4 (patch)
tree66dbdcd98fbb37ba74fe70669deb95aa7e5dbd62
parenta8e66dd657dff28ef7ae9cfbe15ea43e4c08aefd (diff)
avoid linking against the OpenGL libs when only using the window
This lets us avoid to link libsclo against all the OpenGL libraries and only link against libvcl_opengl. Only code actually using the context will need to link against the OpenGL libs. Change-Id: Ia47f4c651702a7fb8517073cda6fb113e7e26e50
-rw-r--r--include/vcl/openglwin.hxx15
-rw-r--r--vcl/source/window/openglwin.cxx31
2 files changed, 39 insertions, 7 deletions
diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx
index 5c57d4507926..9c4e6113c18e 100644
--- a/include/vcl/openglwin.hxx
+++ b/include/vcl/openglwin.hxx
@@ -11,16 +11,23 @@
#define INCLUDED_VCL_OPENGLWIN_HXX
#include <vcl/syschild.hxx>
-#include <vcl/opengl/OpenGLContext.hxx>
+#include <vcl/vclopengl_dllapi.hxx>
-class OpenGLWindow : public SystemChildWindow
+#include <boost/scoped_ptr.hpp>
+
+class OpenGLContext;
+class OpenGLWindowImpl;
+
+// pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
+class VCLOPENGL_DLLPUBLIC OpenGLWindow : public SystemChildWindow
{
public:
OpenGLWindow(Window* pParent);
- OpenGLContext& getContext();
+ ~OpenGLWindow();
+ OpenGLContext* getContext();
private:
- OpenGLContext maContext;
+ boost::scoped_ptr<OpenGLWindowImpl> mpImpl;
};
#endif
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 29a21a2ada81..3065718464b2 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -8,15 +8,40 @@
*/
#include <vcl/openglwin.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
+
+class OpenGLWindowImpl
+{
+public:
+ OpenGLWindowImpl(SystemChildWindow* pWindow);
+ OpenGLContext* getContext();
+private:
+ OpenGLContext maContext;
+};
+
+OpenGLWindowImpl::OpenGLWindowImpl(SystemChildWindow* pWindow)
+{
+ maContext.init(pWindow);
+}
+
+OpenGLContext* OpenGLWindowImpl::getContext()
+{
+ return &maContext;
+}
OpenGLWindow::OpenGLWindow(Window* pParent):
- SystemChildWindow(pParent, 0)
+ SystemChildWindow(pParent, 0),
+ mpImpl(new OpenGLWindowImpl(this))
+{
+}
+
+OpenGLWindow::~OpenGLWindow()
{
}
-OpenGLContext& OpenGLWindow::getContext()
+OpenGLContext* OpenGLWindow::getContext()
{
- return maContext;
+ return mpImpl->getContext();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */